2
votes

I'v built the app, with a working datamodell with one entity. The managedObjectContext works fine with the arrayController, and a TableView. A pretty straightforward, and common setup.

There's almost no code yet, I'm just trying to play a bit with coredata.

The problem is, when I change the modell, for example add a new entity, it no longer compatible, end show two errors while loading the app.

here are the errors:

The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store.

Failed to initialize the store

I guess somehow it tries to load to last model to the array, but i'm not intrested in that. I want to use the new one, and get rid of everything else.

I search stackoverflow and google all around, so I've cleaned the build folder, cleaned the app, still not working. Those folders in Library or Library/Application for my app name does not exists.

How to solve the problem, and make the app to use the new DataModel?

1

1 Answers

3
votes

You have to delete the store file (the actual sqlite store). It will be recreated in your AppDelegate when you start the app again.

  1. If you are using the simulator, you can go into the documents folder and delete it yourself. (Complicated.)

  2. You can set a flag in your program and delete the store if set to true. That is a good setup for testing, especially when your data set is not too large and if you do not need your entered data to persist across relaunches. (Recommended.)

  3. You simply delete the app from the device / simulator. (Easiest.)