Search code examples
iphoneobjective-ccore-datamigrationmapping-model

Core Data Migration: Extracting fields to an abstract entity child


I have a migration where I'm moving fields from one entity into another entity which is a child of an abstract entity. My model has an entity, Thing, which is 1->M to an abstract entity, AbstractWidget, which is the parent for NewStuff. Something like this:

+-------+      +----------------+    +----------+
| Thing |<--->>| AbstractWidget |<---| NewStuff |
+-------+      +----------------+    +----------+

I am moving several attributes from Thing to NewStuff, and I've been following the instructions on a blog post I found that has instructions for making a similar change.

I've created a new version with the structural changes, and created a mapping model that include a mapping called ThingToNewThing, which maps the fields, but does not map the relationship, per the instructions. I didn't make the relationship change, as the AbstractWidgets is already set up to properly work.

When I run my app, I get a whole stream of stuff sent to the console, that starts like this:

2010-06-22 14:14:07.463 MyAppName[31418:207] Unresolved error Error Domain=NSCocoaErrorDomain Code=134140 UserInfo=0x55249d0 "Operation could not be completed. (Cocoa error 134140.)"

... followed by what seems to be a listing of the existing data properties.

I can't find anything about Cocoa error 134140 anywhere, and I'm not sure where to go from here.

Any guidance would be greatly appreciated.


Solution

  • First, start by spitting out the [error userInfo] to the console as well, that will tell you exactly what is the issue.

    Second, copy and past that output into your question so that I can take a look :)

    Update

    Based on the log file you sent to me, here is the underlying issue:

    Can't find or automatically infer mapping model for migration

    This means it is failing to find the mapping model. So either it cannot match up the source model or cannot match up the destination model or your mapping model is not included in the bundle.