"Can't find model for source store" occurring during iphone "Automatic Lightweight Migration"? "Can't find model for source store" occurring during iphone "Automatic Lightweight Migration"? ios ios

"Can't find model for source store" occurring during iphone "Automatic Lightweight Migration"?


You set the version of your data model in the Utilities inspector (right hand pane), under the Identity and Type tab when the xcdatamodeld file is selected. This has a section called "Core Data Model", and a field called "Identifier".

You add a new model version by selecting the xcdatamodeld file, the going to Editor --> Add model version.

At this point it prompts you for the previous model to base it on.

If youve added a new model without going through this process the lightweight migration may not work.


another thing that can cause this, is if you:

  1. make version 2
  2. then edit version 1 accidentally
  3. then make version 2 default
  4. realize your change isn't there
  5. make your change again on version 2

you get the same effect, because the version 1 that you are trying to merge from isn't the version that created the store.


If you made changes to your model and you made sure that you generated a model object AND don't care about the migration nor are interested in making a new version, you simply need to do a Product -> Clean and that will typically fix this issue.

If you are still having this error, locate your sqlite DB and delete it. When you launch the app again it will make a new one that's built from the new model.

Alternatively, you can delete the app from the simulator or, if all else fails, tap on "iOS Settings" at the top of simulator and select "Reset Content and Settings..." and it will quickly wipe the simulator so you can start fresh.