Re: Core Data missing mapping model

Steve Mills

On Aug 5, 2019, at 08:25:33, Steve Mills via Groups.Io <sjmills@...> wrote:

During development of a new version of my app, I added a new data model version with one additional attribute on one of the entities, and a mapping model to set the default value of that new required attribute. I was able to successfully migrate older documents to the new model. Now I can no longer do that, and I have no idea why. I get the error "Persistent store migration failed, missing mapping model." I'm using the options to do automatic migration and to NOT infer model mapping.

I've gone through the painstaking task of comparing the models that are spit out to the Xcode console, and they look correct - they match up with what should be in each model. I've checked the hashes on both the old and new models, and on the persistent store in an old document, and the hashes in the old document match the hashes in the old model.
The problem was caused by a merge. Even though the mapping model LOOKED correct in the Xcode mapping model editor, the underlying data was bogus. So yeah, don't work on a mapping model (or probably any Core Data resource file) on more than one machine at a time and think that merging will magically work.

Steve Mills
Drummer, Mac geek

Join { to automatically receive all group messages.