So the core data recognised that model has changed and failed to create managed context.
A quick search in Google brought me to this article that explains how to deal with such issues when the changes to the mode qualify for so called "light migration".
I take a liberty to copy the solution here:
- Open your .xcdatamodeld file
- click on Editor
- select Add model version...
- Add a new version of your model (the new group of datamodels added)
- select the main file, open file inspector (right-hand panel)
- and under
Versioned core data modelselect your new version of data model for current data model - THAT'S NOT ALL!! You should perform so called "light migration".
- Go to your
AppDelegateand find where thepersistentStoreCoordinatoris being created - Find this line
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) - Replace
niloptions with@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES}(actually provided in the commented code in that method) - Here you go, have fun!
No comments:
Post a Comment