Search code examples
iphoneobjective-ccore-datamapping-model

Preserving core data after app update


I am using core data to store favorites chosen by the user. I would like to know that if I send an app update, how can I keep the data of the favorites preserved after the app is updated by the user?

I have read that you could use versioning, but I'm not sure if this the correct method.

Any help will be appreciated! Thanks


Solution

  • If your app maintains the same bundle identifier and you don't copy over the core data store file, you keep it.

    If you changed your Core Data model, then you do need to worry about versioning. Depending on changes you may need to write rules for migrating data in the old store to the new format. As you have probably experienced, if you change data structure and do not migrate (or wipe existing data), you crash.