Core Data store disappears when app is removed from task list in 4.0
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, the开发者_StackOverflow社区re 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?
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.
精彩评论