I have two versions of my model Model001.xcdatamodel
and Model002.xcdatamodel
. These two are in the Model.xcdatamodeld
bundle.
I also have
You are not allowed to make any changes to the source/destination model after you have created the mapping models.
If you do make some changes,
mappingModelFromBundles:forSourceModel:destinationModel:
will not be able to find the mapping model fileaddPersistentStoreWithType:configuration:URL:options:error:
with {NSInferMappingModelAutomaticallyOption: @NO}
will report an error "Can't find mapping model for migration"migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:
will report an error "Mismatch between mapping and source/destination models"So, just recreate the mapping model and copy every change you made in the old one.