longbow
longbow

Reputation: 1623

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.

Upvotes: 0

Views: 326

Answers (1)

mt81
mt81

Reputation: 3318

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.

Upvotes: 3

Related Questions