Note that there are some explanatory texts on larger screens.

plurals
  1. POCore data migration involving a new entity and a to-many relationship
    text
    copied!<p>I am attempting to add a new entity (say B, with two "double" attributes) to my core data model and create an optional to-many relationship with an existing entity (say A). I created the new model revision that includes the new entity B, the existing entity A, and a to-many relationship A ->> B. This new model is the default model. I created a mapping model from v2 to v3 (v1 -> v2 migration works fine, just data type changes for entity A), but did not specify a value expression for A's relationship to B, nor value expressions for B's attributes.</p> <p>When I run the app, I receive the following error when attempting to instantiate the managed object model <code>managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];</code>.</p> <p><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray insertObject:atIndex:]: attempt to insert nil object at 0'.</code></p> <p>The problem is probably that I did not specify a value expression for A's relationship to B in the mapping model, but I thought that its not necessary because B is optional and it did not exist in v2 of the model. If I do have to specify a value expression for relationship, how do I do so for a non-existent (as it doesn't exist in v2 of the model) optional relationship?</p> <p>Any help is greatly appreciated.</p> <p>PS - one more question - is a mapping model even necessary, or is automatic migration smart enought to to handle the new entity and the relationship? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload