0

I have some local JSON files which I'm bundling with the app. When Xcode builds the product and I look into the payload directory, I can see the JSON in plain text.

Is there a way to have Xcode compile the file in binary form, and then still be able to parse it with NSJSONSerialization?

I load the JSON file like this:

NSData *data = [[NSData alloc] initWithContentsOfFile:path];

The data is then converted to a JSON object:

id json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];

So could Xcode convert the JSON text file into binary form before adding it to the app package?

openfrog
  • 40,201
  • 65
  • 225
  • 373

1 Answers1

0

I think that what you really need is to encrypt your data. In detail, you need to encrypt your json file, save and add it to your xcode project and then open, decrypt and use it in your application. Here: AES Encryption for an NSString on the iPhone you can find a discussion on how to do it.

Community
  • 1
  • 1
Michele Percich
  • 1,872
  • 2
  • 14
  • 20