3

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

westsider
  • 4,967
  • 5
  • 36
  • 51
Peter
  • 181
  • 2
  • 10

1 Answers1

1

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.

Adam Eberbach
  • 12,309
  • 6
  • 62
  • 114
  • Thanks for the answer. I don't think I will be changing the core data model but could you please tell me how to find the bundle identifier. Also, should I be careful not to copy over the ".xcdatamodel" file? or another core data store file. Thanks again. – Peter Mar 23 '11 at 05:24
  • Bundle identifier is in your projects -Info.plist, found under Resources in most Xcode templates, usually something like "com.apple.ContactsApp" - where the first bit is your own reverse domain and the last bit is your project name. If you don't edit the .xcdatamodel file ("The Model") you will probably be fine. – Adam Eberbach Mar 23 '11 at 06:15