简体   繁体   中英

App update CoreData saved?

Does the Device retain any old CoreData entries if you just do an app upgrade doing bugfixes etc. that does not touch the CoreData implementation in any way? or will it create a new database for all versions of the app?

update should be deployed via ad-hoc build and manual install via iTunes.

The data saved by the device remains if the app isn't deleted and reinstalled.

After the app have been updated, at the first launch, Core data looks for differences between the old NSManagedObjectModel and the new one.

If the new model is different you need to make a data migration, otherwise the app crashes.

Apple offers an automatic data migration "Lightweight Migration" , this works most of the times. In order to use the Lightweight Migration you must add a version to your Core Data Model file, and call some methods: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/Introduction.html .

MagicalRecord https://github.com/magicalpanda/MagicalRecord could help you a lot with the migration and with Core Data in general.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM