5

I'm trying to migrate a Core Data store using a mapping model, but I get this error: "Persistent store migration failed, missing mapping model."

My app finds the mapping model, but doesn't use it, even though the hashes match. This is the migration debug log:

2013-04-18 23:23:53.256 MyApp[30934:303] CoreData: annotation: Incompatible version schema for persistent store 'file://localhost/Users/Clemens/Library/Containers/com.my-company.MyApp/Data/Library/Application%20Support/com.my-company.MyApp/MyApp.storedata'.  store metadata = {
    NSPersistenceFrameworkVersion = 407;
    NSStoreModelVersionHashes =     {
        Project = <71e5190c 4e7bdecf 0fcc5df6 72120586 e6ec3b83 9aecd871 6847c9c1 4e888a06>;
        Task = <e7df7dad d3710c84 2cc82543 7ef549e2 a4fa5818 b243b97e 5a734d49 5c1ce19f>;
        WorkPeriod = <ed62858b 98bacd8d 70442733 07caae00 f82073d8 dd67fd68 c703778f 4b6c7c37>;
    };
    NSStoreModelVersionHashesVersion = 3;
    NSStoreModelVersionIdentifiers =     (
        ""
    );
    NSStoreType = XML;
    NSStoreUUID = "397108D9-D465-41E4-B5FA-45701DAC5B4D";
} and current model versions = {
    Project = <919c7227 b911a0f2 25df6d2a 2f939989 37e81707 b7dcacfd 4570d7e0 b965f75d>;
    Task = <b5a7c7a5 1efc83d7 a3dda24d 44251466 0552d7db 5beb1491 1048b48e f9032df2>;
    TaskPreset = <6f6ab28a c7a3e78f c6856bf8 b56b8efc f9d2ac0b 30b80356 86367d31 bf94b507>;
    TaskPresetGroup = <9b892cb1 2948fb51 cb25a8db 89515654 d55069b2 1081a669 2c56bb21 a9c7c156>;
    WorkPeriod = <5360e9c9 91d2c313 0a9ca2e1 b348b5c3 8176831e 7fc9748f d43623b1 364ecfb9>;
}
2013-04-18 23:23:53.257 MyApp[30934:303] CoreData: annotation: (migration)   will attempt automatic schema migration
2013-04-18 23:23:53.298 MyApp[30934:303] CoreData: annotation: (migration) looking for mapping model with 
 source hashes: 
{
    Project = <71e5190c 4e7bdecf 0fcc5df6 72120586 e6ec3b83 9aecd871 6847c9c1 4e888a06>;
    Task = <e7df7dad d3710c84 2cc82543 7ef549e2 a4fa5818 b243b97e 5a734d49 5c1ce19f>;
    WorkPeriod = <ed62858b 98bacd8d 70442733 07caae00 f82073d8 dd67fd68 c703778f 4b6c7c37>;
}
 destination hashes: {
    Project = <919c7227 b911a0f2 25df6d2a 2f939989 37e81707 b7dcacfd 4570d7e0 b965f75d>;
    Task = <b5a7c7a5 1efc83d7 a3dda24d 44251466 0552d7db 5beb1491 1048b48e f9032df2>;
    TaskPreset = <6f6ab28a c7a3e78f c6856bf8 b56b8efc f9d2ac0b 30b80356 86367d31 bf94b507>;
    TaskPresetGroup = <9b892cb1 2948fb51 cb25a8db 89515654 d55069b2 1081a669 2c56bb21 a9c7c156>;
    WorkPeriod = <5360e9c9 91d2c313 0a9ca2e1 b348b5c3 8176831e 7fc9748f d43623b1 364ecfb9>;
}
2013-04-18 23:23:53.300 MyApp[30934:303] CoreData: annotation: (migration) checking mapping model at path file://localhost/Users/Clemens/Library/Developer/Xcode/DerivedData/MyApp-fcaoexogoreuawfnznnkmnjtqwop/Build/Products/Debug/MyApp.app/Contents/Resources/MappingModel.cdm
 source hashes: 
{(
    <ed62858b 98bacd8d 70442733 07caae00 f82073d8 dd67fd68 c703778f 4b6c7c37>,
    <71e5190c 4e7bdecf 0fcc5df6 72120586 e6ec3b83 9aecd871 6847c9c1 4e888a06>,
    <e7df7dad d3710c84 2cc82543 7ef549e2 a4fa5818 b243b97e 5a734d49 5c1ce19f>
)}
 destination hashes: {(
    <9b892cb1 2948fb51 cb25a8db 89515654 d55069b2 1081a669 2c56bb21 a9c7c156>,
    <b5a7c7a5 1efc83d7 a3dda24d 44251466 0552d7db 5beb1491 1048b48e f9032df2>,
    <6f6ab28a c7a3e78f c6856bf8 b56b8efc f9d2ac0b 30b80356 86367d31 bf94b507>,
    <5360e9c9 91d2c313 0a9ca2e1 b348b5c3 8176831e 7fc9748f d43623b1 364ecfb9>,
    <919c7227 b911a0f2 25df6d2a 2f939989 37e81707 b7dcacfd 4570d7e0 b965f75d>
)}
2013-04-18 23:23:53.301 MyApp[30934:303] CoreData: annotation: (migration) no suitable mapping model found

I have no idea, why my mapping model is not suitable. Does anybody know, what I'm doing wrong?

WetFish
  • 1,172
  • 2
  • 11
  • 21
  • Do you have a (optional) to-one relationship with the minimum value set to 0? http://stackoverflow.com/questions/15703040/core-data-migration-fails-for-to-one-relationship and http://stackoverflow.com/questions/15979179/coredata-migration-failing-no-suitable-mapping-model describe similar issues (which sounds like a Core Data bug to me). – Martin R Apr 19 '13 at 05:18
  • @martin-r I'm using an optional relationship with the maximum value set to 1 and no minimum value. Its inverse is an optional to-many relationship without min or max values. – WetFish Apr 19 '13 at 11:31
  • Setting the minimum count to 1 doesn't fix the problem. – WetFish Apr 19 '13 at 11:37
  • The author of the first link describes that he had exactly this problem if no minimum value is set for the optional relationship. I could reproduce the issue but do not have an explanation. In that case, the error did not occur if the minimum value is set to 1. - I was just curious if this is the same problem. – Martin R Apr 19 '13 at 11:39

0 Answers0