Re: Core Data merging
Re: Core Data merging
- Subject: Re: Core Data merging
- From: Vadim Lozko <email@hidden>
- Date: Fri, 15 Aug 2008 08:26:29 -0400
On Aug 15, 2008, at 6:09 AM, Tim Isted wrote:
On 15 Aug 2008, at 00:19, Vadim Lozko wrote:
I'm having a problem trying to upgrade an existing store of a Core
Data database to a newer model that simply has 1 additional
attribute property in an entity. This is not a document based app.
Also, not sure if this is significant, but the xcdatamodel and all
related files are stored in a framework.
[...]
I tried to go about this two different ways. One was was to include
only the newer model file and the mapping file to the build.
However, the error I get is:
Error while adding persistent store: Error
Domain=NSCocoaErrorDomain Code=134140 UserInfo=0x3c9030 "Persistent
store migration failed, missing mapping model."
You do need to have the relevant data models inside your project,
normally stored inside a datamodel bundle...
However, when I include all three files (both model and the
mapping), it seems like it's trying to merge the two and ignore the
mapping file altogether. The error I get is:
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Can't merge models with two
different entities named 'SomePrivateEntityName''
This particular problem is normally reasonably easy to fix.
Are you storing your data models in a data model bundle
(filename.datamodeld)? You can then specify in Xcode which one is
the current version. Assuming this is done, make sure that only one
of your data models (the current version) has its target checkbox
ticked, but don't tick any of the others. Sometimes you need to un-
tick them all and re-tick them, or occasionally I've had to clean a
project to get Xcode to accept and obey different ticks. If you have
two data models (usually inside a bundle) included in the target and
they have some or all of the same entity names inside, you will get
this error if both models are being included in the target app.
HTH,
Tim
_______________________________________________
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
It seems like your two responses contradict themselves. First, you
want me to include all the relavent models. In your second response
you want me to only include only the one model. I did specify that the
models are part of a framework, so they wouldn't be part of the
resources of the app. And if XCode had a physical interface, the clean
button would have been worn out a long time ago. If I follow the steps
to your second response, i'll go right back to the same error your
first response was for. And yes, It is inside a datamodeld with one
checked off as the current version. For the record, when I include
only the newer datamodel, the error I get is:
Error while adding persistent store: Error Domain=NSCocoaErrorDomain
Code=134130 UserInfo=0x34f0c0 "Persistent store migration failed,
missing source managed object model."
I've also tried attaching a copy of the datamodeld package into the
resources of my app but it doesn't help.
Vadim Lozko
_______________________________________________
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