Re: core data lightweight migration woes
Re: core data lightweight migration woes
- Subject: Re: core data lightweight migration woes
- From: Martin Hewitson <email@hidden>
- Date: Tue, 18 Jun 2013 09:43:00 +0200
>>
>>
>> I just had another thought.... I have another core data model in the app. I wonder if the NSPersistentDocument infrastructure is picking up the wrong model? As I'm looking through the project, I realise I don't know how the document knows which core data model to use.... OK, back to the documentation on NSPersistentDocument.
>>
>
> By default it will merge all models in the main bundle. So if the other model changed, you would also have a problem. If you want to specify only one model for the document, you should override [NSPersistentDocument managedObjectModel].
Yes, thanks. I got that from the documents, but doing an override and explicitly pointing to the model doesn't help.
I have then gone on to check the entity hashes in the XML store on disk against the hashes in the model loaded for that XML store using this snippet:
NSError *metaerror = nil;
NSDictionary *storeMeta = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:nil URL:url error:&metaerror];
NSLog(@"Metadata at URL %@", storeMeta);
NSManagedObjectModel *oldManagedObjectModel = [NSManagedObjectModel mergedModelFromBundles:@[[NSBundle mainBundle]]
forStoreMetadata:storeMeta];
NSLog(@"Old managed object model %@", [oldManagedObjectModel entityVersionHashesByName]);
and the hashes all match. So I don't know why the migration says it's can't locate the source model since I can locate it myself.
More digging...
Cheers,
Martin
_______________________________________________
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