I followed the guide found here:
http://www.timisted.net/blog/archive/core-data-migration/
but keep getting "Can't find mapping model for migration" when I start up the app with the new model. I've tried it in xcode 3 and xcode 4, multiple times, but can never get it to work.
Currently my options are set to:
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:NO], NSInferMappingModelAutomaticallyOption,
nil];
I had YES set for the infer option before but then it was just migrating without calling my custom policies that I need to migrate, which I assume is cause it couldn't find the mapping model before either.
Any reason my mapping models aren't getting picked up? I've double checked that no changes were made to the previous model by checking it against the SVN version of it.
Thanks.
Turns out the Mapping Model needs to be part of the .xcdatamodeld package, which is impossible to do within xcode 4. With it in there, it works great.
Note: my mapping file stopped working again, and I found that it was 0KB on disc, so I had to recreate it again and it worked fine after that. I quickly committed it and will see if it disappears again. The problem is that Xcode 4 indexes it or something so it looks fine in xcode but on the file system its empty.
See my comment below for the reason (xcode 4's mapc (map compiler) is broken).
** THIS HAS BEEN FIXED IN THE NEWER XCODEs/SDKs.**
I had a similar problem:
Custom Policy in my xcmappingmodel will not be executed
in my case it was not executed since my migration did not do any changes to the tables - maybe this is your problem too.
Make sure to set up the source data model as your OLD version, and the destination as the new one... I have gotten the error above when these were backwards.
you need to create a new version of the schema, as opposed to changing the current version. presuming you have done this, what changes have been made to the model? some changes are too drastic to be inferred reliably.