4

I have an app released, and I want to release a new version.

The new version has a very small change in the Core Data model: adding a BOOL attribute ("hasUpdated") to an entity ("Users").

How would I migrate without the app crashing after being updated (obviously) or changing the existing data?

cannyboy
  • 24,180
  • 40
  • 146
  • 252

1 Answers1

3

First, make sure the data model you are using (with the new BOOL attribute) is a different version than the one that you have released. To create a new model I believe it's something like Editor -> Add Model Version -> and then name it / tell it which model to be based from.

Now set the new model as the current version in the utility pane. For help on this check out this post: Xcode 4, Core Data Model Version - Set Current Version

For such a simple change you should be able to tell the persistent store to perform lightweight migration. This post should explain that: Implementation of "Automatic Lightweight Migration" for Core Data (iPhone)

Community
  • 1
  • 1
Mike
  • 2,399
  • 1
  • 20
  • 26