I like the smell of Swift in the morning…

CoreData error: “The model used to open the store is incompatible with the one used to create the store”

Posted: | Author: | Filed under: iOS, Xcode | Tags: | 4 Comments »

When I started to play around with CoreData for the first time, I came across a strange error. The error description said “The model used to open the store is incompatible with the one used to create the store”. At first I just couldn’t figure out what the problem was. As soon as I tried to access the NSManagedObjectContext the app crashed.

The solution is really simple: Whenever you change something your CoreData data model, you have to delete the old compiled app from the simulator or device. CoreData uses SQLite3 which is nothing more than a file in your app’s filesystem. If you do not delete the old version of your app the file remains in the file system and does not reflect the changes that you made in the data model. The SQLite file will only be deleted when you delete the whole app.

So the golden rule is: Whenever you change something in the data model of your CoreData driven App, make sure to delete the old version of the app before compiling and running the new one.


  • 1

    cocktail dresses can be of any color12said at

    I significantly appreciate your posts. Thank you

  • 2

    prabhatsaid at

    this is totally wrong i think,

    if your app is already on app store but in Update for it you did some changes in DB so what will be your call.

    if user will delete the app we will loose all his data.

    sorry not satisfied with your answer.


  • 3

    Jörnsaid at

    Hi Prabhat,

    thanks for your comment. Maybe I was not clear enough: my answer is only meant for apps that are still in development and not for apps that are already published in the AppStore. Once your app is published and you have to change something in you data model you have to use the migration methods Apple provides (as described here: https://developer.apple.com/library/mac/documentation/cocoa/conceptual/CoreDataVersioning/Articles/Introduction.html)

  • 4

    Robsaid at

    Thanks for this, saved much stuffing about 🙂

Leave a Reply