0

I have a file Settings.plist. When I update the values and restart the app, the values are the same that in the initiale file Settings.plist...

I open the file like that :

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"plist"]; NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];

make update and then save

[settings writeToFile:filePath atomically:YES];

After that, if I open the file, the values are the new, that's ok, but when I restart the app, all the values are reset.

Sierpinski
  • 81
  • 2
  • 10

1 Answers1

0

The application bundle is read only, the reason you are able to access it while the app is still foregrounded because the file is cached. You should be writing the file to the documents or other acceptable directories for storing data. The app bundle is not the proper place to save file changes as even if it did write it would not be properly backed up to the user's computer.

Kyle Richter
  • 450
  • 2
  • 6