I’ve just opened the core data database of a customer who was using the app while he had a black out, so his mac turned off while saving the core data model.
The debugger says: Error: Persistent store migration failed, missing mapping model.
Is it because the model has been updated incorrectly and some parts are missing/invalid ?
Can I do something to restore this database ?
thanks
Apparently the model – the one described in the .xcdatamodel file – is no longer in sync with the actual data in the store. This happens when you make changes to your model: add entities, relations, change attributes etc.
To transfer the data from the store to the new model you use a Core Data mapping model (.xcmappingmodel file). This file describes the various modifications to your data model and allows Core Data to do a migration of the data from a previous version of the model to the new version. If this file is missing the data cannot be migrated/transferred to the new version of the model. Apparently, judging from the message received, the mapping model is not there.
The cause for this could be many, maybe because of a faulty build. Double check that the app has access to the mapping model and retry. If data is corrupted, you could try and use a backed up version of the data with a timestamp just before the black out and see if the migration will work from there.