Re: Core Data Mapping Model: New attributes missing in Editor
Re: Core Data Mapping Model: New attributes missing in Editor
- Subject: Re: Core Data Mapping Model: New attributes missing in Editor
- From: Michael Babin <email@hidden>
- Date: Mon, 01 Jul 2013 23:45:45 -0500
On Jul 1, 2013, at 8:51 PM, Jerry Krinock <email@hidden> wrote:
> The Mapping Model editor in Xcode 4.6 is not showing new attributes of entities in the destination. Here is what I did.
>
> • Enter the Organizer - Documentation.
> • Search for "TwoManyControllers". An Apple sample project named "Crossing To-Many Relationships with Cocoa Bindings" will be found.
> • Open that sample project.
> • Create a new Core Data Model Version.
> • Open this new Model Version in the editor.
> • To the entity "Product", add another attribute, "flavor", of type String.
> • Create a new Mapping Model open it in the editor.
> • Set the source model to the original data model.
> • Set the destination model to the new data model.
>
> Now say I want to add an Attribute Mapping for the new Destination Attribute, "flavor". In real life, this would happen if legacy Products did have a flavor, which is not specified in the data model, but is derivable from other attributes. So, still editing the mapping model,
>
> • In the ENTITY MAPPINGS source list, select ProductToProduct.
> • Add an Attribute Mapping. Its Destination Attribute shows up as "No Value".
> • Click the "No Value" to show its popup menu.
>
> Expected Result: The new attribute, "flavor", should be an item in the popup menu.
>
> Actual Result: It's not. Only the legacy attribute(s) of Product are in the popup menu.
>
> Why not?
I get an error after step 3 (project is open) whenever I select the MyDocument.xcdatamodel. Tried with both Xcode 4.5.2 and Xcode 4.6.3. Perhaps there is some problem or incompatibility with that file?
I did download the "Normalized String Searching Using a Core Data Derived Property" sample code project (DerivedProperty.xcodeproj) from the Mac Developer site and was able to open the included APLDocument.xcdatamodeld file without problem. Created a new model version, made the new version the current version, selected the new model version and added a "flavor" attribute of type String to the APLLogEntry entity. When I created the mapping model from APLDocument to the new version (APLDocument2), the one entity mapping (APLLogEntryToAPLLogEntry) already contained an entry in the attribute mappings with a destination attribute of "flavor" (with a blank Value Expression).
Did you perhaps define the new attribute after you had created the mapping model? If so, does "Refresh Data Models" and/or "Update Default Mappings" (Editor menu with mapping model selected) have any effect?
I will echo Juan Fernandez's experience with the generated mapping model not being usable at runtime to migrate a store. Ran into that same problem recently.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden