Reputation: 4413
I'm trying to save data to a Plist and I figured the best place would be in the Delegate .m "applicationWillTerminate" since Apple thoughtfully places a comment there "Save data if appropriate".
However, it seems that this method never gets called when I'm testing with the iPhone Simulator. My NSLog statement never gets run.
So, is this the best place to save data when exiting the app and if so, do you know why it never seems to get called?
Upvotes: 0
Views: 234
Reputation: 17081
Or you could just save your Plist when it is changed, that way you always know the data is up to date.
Upvotes: 1
Reputation: 59277
Since iOS 4 applications can enter in "background" instead of terminating, so applicationWillTerminate:
may not be called.
You may want to use applicationDidEnterBackground:
also. You can create a method to save the data and call it in both delegate methods.
Upvotes: 4