been banging my head.
I added a new model version for my database for migration and added a new attribute but when I run the app without deleting it I get
Can't find model for source store . I tried to debug and noticed that the persistent store can't get created.
I have all the migration stuff set up but I can't figure out why it cannot create the persistent store.
The error seems to point out to my model not being present and I tried to debug and I can see that it gets created and the model is under the documents folder. Any help would be greatly appreciated. I am also using restkit.
Cheers.
You need to delete previous incompatible persistant file. Code below worked for me:
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
[[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil];
[_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error];
}