View Full Version : Storing information on info.plist

Nov 1, 2009, 01:43 PM

I was wondering what's the best way to store information in an app. I just need to store two values, and I thought the best way to do it is just to use the info.plist.

I am using this code store the the data on the info.plist:

[[[NSBundle mainBundle] infoDictionary] setValue:[NSNumber numberWithInt:row] forKey: @"exchangeRateCurrencyIndex"] ;

I know that it changes the value while the app is running. But the problem is that the next time I start the app it goes back to the original value the field was set in xcode. (I used both the simulator and the device to debug).

Any ideas why it's doing this?

Nov 1, 2009, 02:01 PM
You can't modify the Info.plist file. On the device it's inside your application bundle and that is read only. It would ruin the signing of the app if you did change it.

For two values you should use NSUserDefaults.

If you had a lot of data that you wanted to save to a plist file you could write a plist file to your Documents folder.