views:

25

answers:

1

Under 4.0, my iOS application which uses Core Data loses all stored data when the application is suspended and subsequently removed from the background task list. Data persists fine between suspensions, but when the app is killed, there is no data on relaunch.

Under 3.1, data persisted just fine between quits/relaunches of the app.

Does this sound like anything you've run into before or the result of a common mistake?

+1  A: 

Aha!

It's important to note that the UIApplicationDelegate method applicationDidEnterBackground is called instead of applicationWillTerminate under 4.0. As such, if your Core Data managedObjectContext is being saved out in the applicationWillTerminate method, you must also save in applicationDidEnterBackground, or no save will take place.

MikeyWard