Reputation: 1977
I've got an app that has had many many core data migrations, with several developers working on the project, at one point it appears there was a failure to properly migrate the core data model. The end result is that people who upgraded from a particular version of the app to the current version of the app are unable to save their context to the store (this save occurs when the application enters background).
The error logged is as follows :
This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.
Fortunately, the users are unlikely to notice too much from this crash and error, as it occurs during the app's exit and the app is designed to simply retrieve any data from the web that is missing locally so a failed save isn't as critical as it would be if any user created data was being lost. Of course, this is less than ideal, to have to redownload data that is just not being saved to the store on app exit.
My question ultimately is how do I go about fixing this issue going forward?
My idea is to release a minor update that completely resets the core data persistent model. Wipe out any old data stores, and start fresh (remember the data all comes from the server). There will be no data loss to the user, and this would solve things going forward. Is there a better idea?
Also, if that were how I decided to do things, how exactly would I go about doing this properly? Would I just look in my bundle and delete any .momd files and then recreate a new one with a different name? Or is deleting unnecessary and just giving new names would give the desired reusults?
Upvotes: 0
Views: 155
Reputation: 119021
To fully reset you can add a check in your applicationDidFinishLaunching
which:
To fix:
Upvotes: 2