Aprove answer

When you do ListAppViewController* listView = [[ListAppViewController alloc] init], you create a new instance of the view controller. If the intention is to save any data you had in that view controller, this won't work (as you're not accessing the instance your app has been using).

Here's how you can do what you want:

  1. Post a notification from your app delegate's applicationWillTerminate method
  2. Subscribe to that notification in ListAppViewControllerList
  3. Call [self saveData] in the notification handler.


applicationWillTerminate is basically never called. You need to trigger the save when the app goes to the background (resigns active).

Credit Goes to: stackoverflow.com

Related question with same questions but different answers