Katz
Katz

Reputation: 866

The model used to open the store is incompatible with the one used to create the store Xcode 7.1

I created a core data model that was working fine until I added a new entity to the model, my code is fine I think... because Xcode can't detect any errors, but as soon as I run my app on the simulator the compiler gives me an error saying

reason=The model used to open the store is incompatible with the one used to create the store

I don't quite understand what this error means. I did search for references regarding this error but the one I found is outdated it was from Xcode 3.2, I'm currently running Xcode 7.1.1, interestingly enough there's no check mark on none of the replies. Despite that I still tried to use some of those methods and nothing has worked.

Things I tried

Upvotes: 3

Views: 4453

Answers (2)

Logicsaurus Rex
Logicsaurus Rex

Reputation: 3192

My favorite solution is to open the sqlite database with a third party app, then open the Z_MetaData table and delete the row found in there.

Works like a charm every time.

It may affect your 'migration' if you do migrations.
We do not, so not an issue.

Upvotes: 0

Tom Harrington
Tom Harrington

Reputation: 70936

That error means that you changed the model so that it doesn't match the one you were using when you created the app's data. It's the classic sign of changing a data model and not either doing model migration or deleting the app from the phone/simulator (and it's been pretty much the same as long as Core Data has existed, so old information is not irrelevant). Deleting the app from the simulator would normally be all that's needed to run the app again. If it's not working, then you're somehow leaving old data in place.

The best way to delete an app from the simulator is usually the same as you'd delete an app on a real device-- click and hold until the app icon starts moving, then click the "x" on its icon to delete it.

If deleting the app doesn't help, you're using old data some other way. Maybe you have some pre-loaded data built into the app that was configured using an old version of the model?

Upvotes: 14

Related Questions