Re: Issue with Core Data Mapping Model
Re: Issue with Core Data Mapping Model
- Subject: Re: Issue with Core Data Mapping Model
- From: John Brayton <email@hidden>
- Date: Wed, 23 Jan 2013 22:06:52 -0500
Yes, the hashes do change when I add the model mapping.
I ended up writing an NSEntityMigrationPolicy for a parent object that copies these child entities.
In addition, I also opened up a DTS incident with Apple. The gentleman from Apple observed that I had an interesting difference between model versions:
* In the prior version, I had an entity that was optional and had a minimum and maximum count set to 1.
* In the newer version, the minimum count was not set.
It is odd that the minimum and maximum values even exist, since the relationship in question is not a to-many relationship. I honestly don't know if I set these values or if Xcode did that for me. At any rate, setting the minimum count back to "1" seemed to make the mapping model recognized by Core Data.
I hope this helps you.
John
On Jan 22, 2013, at 12:12 PM, Sean McBride <email@hidden> wrote:
> On Thu, 17 Jan 2013 21:45:51 -0500, John Brayton said:
>
>> I am building a mapping model between two versions of my Core Data
>> model, and I am encountering a strange issue:
>>
>> * If I define six of the seven entity mappings I need in the mapping
>> model, migrating the data works as expected.
>>
>> * When I add the seventh entity mapping, the migration fails with this error:
>> Persistent store migration failed, missing mapping model.
>>
>> * If I delete that seventh entity mapping, the migration works again.
>>
>> * I am trying to do the migration by calling addPersistentStoreWithType:
>> … on the NSPersistentStoreCoordinator.
>>
>> * Reading in both the source and destination models with
>> NSManagedObjectModel initWithContentsOfURL:... works as expected.
>>
>> * Reading in the NSMappingModel with initWithContentsOfURL:… works as
>> expected.
>>
>> * With the seventh entity mapping added, reading in the mapping model
>> with [NSMappingModel mappingModelFromBundles:@[bundle]
>> forSourceModel:source destinationModel:dest] returns null.
>
> This sounds a lot like something I am seeing. Do you see hash mismatches like described here:
>
> <http://stackoverflow.com/questions/10894383/core-data-mapping-model-version-hashes-not-matching-to-source-model-version-hash>
>
> I've spent hours on it, and as best as I can tell Xcode is generating invalid xcmappingmodel files. Just the other day I've used a DTS incident on this, but have not heard back yet. I'll follow up in this thread when I do.
>
> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng email@hidden
> Rogue Research www.rogue-research.com
> Mac Software Developer Montréal, Québec, Canada
On Jan 22, 2013, at 12:12 PM, Sean McBride <email@hidden> wrote:
> On Thu, 17 Jan 2013 21:45:51 -0500, John Brayton said:
>
>> I am building a mapping model between two versions of my Core Data
>> model, and I am encountering a strange issue:
>>
>> * If I define six of the seven entity mappings I need in the mapping
>> model, migrating the data works as expected.
>>
>> * When I add the seventh entity mapping, the migration fails with this error:
>> Persistent store migration failed, missing mapping model.
>>
>> * If I delete that seventh entity mapping, the migration works again.
>>
>> * I am trying to do the migration by calling addPersistentStoreWithType:
>> … on the NSPersistentStoreCoordinator.
>>
>> * Reading in both the source and destination models with
>> NSManagedObjectModel initWithContentsOfURL:... works as expected.
>>
>> * Reading in the NSMappingModel with initWithContentsOfURL:… works as
>> expected.
>>
>> * With the seventh entity mapping added, reading in the mapping model
>> with [NSMappingModel mappingModelFromBundles:@[bundle]
>> forSourceModel:source destinationModel:dest] returns null.
>
> This sounds a lot like something I am seeing. Do you see hash mismatches like described here:
>
> <http://stackoverflow.com/questions/10894383/core-data-mapping-model-version-hashes-not-matching-to-source-model-version-hash>
>
> I've spent hours on it, and as best as I can tell Xcode is generating invalid xcmappingmodel files. Just the other day I've used a DTS incident on this, but have not heard back yet. I'll follow up in this thread when I do.
>
> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng email@hidden
> Rogue Research www.rogue-research.com
> Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden