开发者

Core Data store disappears when app is removed from task list in 4.0

开发者 https://www.devze.com 2023-01-04 21:15 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消