Purva
Purva

Reputation: 1291

Core Data Error

I am creating an application using Core Data. But When I run my app it crashes. It shows me this reason:

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

What should I do now?

Upvotes: 1

Views: 195

Answers (3)

Parth Bhatt
Parth Bhatt

Reputation: 19479

I think you need to refer this link and refer to answer given by Grouchal in the link below:

What do I have to do to get Core Data to automatically migrate models?

If you need any further help please do let me know.

Hope this helps you.

Upvotes: 1

salo.dm
salo.dm

Reputation: 2315

You can just delete the app (icon) from the simulator or device. Then, rebuild and run.

As dave explained, you have modified the core data structure (the store). If you're using the standard template, in the new rebuild a new model (NSManagedObjectModel) will be created that is compatible with your newly modified store.

You will probably be making many changes to the core data structure (adding or deleting an entity or some property or relationship), and, each time you do, you can just delete the app from the simulator or device.

Upvotes: 1

daveoncode
daveoncode

Reputation: 19618

It means that you created a model, run the app, modified the model (by adding or removing managed objects, renaming object properties and so on...) and reopened the app without migrating the data first. I still have to try this by myself but, you should definitely take a look here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataVersioning/Introduction/Introduction.html

Upvotes: 1

Related Questions