Re: Core Data completely unable to find the source object model for migration
Re: Core Data completely unable to find the source object model for migration
- Subject: Re: Core Data completely unable to find the source object model for migration
- From: Adam Swift <email@hidden>
- Date: Thu, 6 Aug 2009 15:29:33 -0700
On Aug 6, 2009, at 10:37 AM, Matteo Manferdini wrote:
To further investigate the matter, I logged the contents of both the
NSStoreModelVersionHashesKey dictionary from my store metadata and the
dictionary returned by the entityVersionHashesByName: method of my
source model. I did this both for my working app without versioning
and the not working one with versioning.
What I discovered is that in the first case the hashes are the same
for the model and the store, while in the second case the model has
lost a lot of metadata in the versioning process. Along with my
entities there are also other entities listed in the hashes (to name a
few: CalDAVCalendar, CalendarChangeRequest, LocalGroup, etc). These
entities hashes are lost in the versioned model, while my entities
hashes remain the same.
Any idea of why this is happening? It seems to me that this is an
XCode bug.
Thank you.
This can happen as a side effect of the old template code that merges
a model using all managed object models from the application resources
as well as all frameworks linked into the application. If you've got
the calendar store framework linked into your project (directly or
indirectly), you'll get the entities you discovered in the version
hash metadata merged into your model at run time, and those entities
will be included in the store file created from the merged model.
It sounds like your original (non-versioned) app and store file are
pulling in all of these extra entities, but your new (versioned) app
does not. Unless you're using those entities, you really don't want
them in your store file or your run-time model.
if you can't just dump your old store file and start fresh (if you
need to migrate your customer's data), what you'll want to do is
create a source datamodel that includes the calendar store entities
that were merged in previously as your source datamodel. I'd suggest
creating another version of your "pure" source data model exclusively
for this purpose and then add the entities from the calendar store
data model (using Xcode->Design->Data Model->Import...), you'll need
to copy the compiled calendar store model from /System/Library/
Frameworks/CalendarStore.framework/Resources/CalendarStore.calmom to a
new file with the file extension ".mom" so the data model import will
recognize the file type as valid.
Then create a mapping model from that 'merged' source model to the
real destination model.
Hope that helps,
- adam
Thank you very much.
Regards.
Matteo Manferdini
Pawn Software
www.pawn-soft.com
_______________________________________________
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
_______________________________________________
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