Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you've got some conceptual confusion going on here between entities and managed objects. </p> <p>Entities are <strong><em>abstractions</em></strong> analogous to Classes. Managed objects are actual individual <strong><em>instances</em></strong> of NSManagedObject or one of its subclasses. Entities in the data model tell the managed object context what attributes and relationships to one another the managed object instances will have. </p> <p>Entities exist solely in the data model whereas Managed objects are in the "object graph" which is the actual functioning group of related objects alive in memory. Entities simply describe to the managed object context how everything fits together much as a class definition tells the compiler how all the properties and behaviors of fit together in a class. Managed objects as instances have data and behaviors just like all other live objects. </p> <p>Likewise, a managed object context does not add, remove or set the values of entities in any way. Instead, it adds, removes or set the values of managed objects configured by the entities in it's data model. </p> <p>So, when you say:</p> <blockquote> <p>I've got a managedObjectContext with 2 entities, each of which contains multiple entities.</p> </blockquote> <p>What you really mean is:</p> <p><em>I've got a data model with 2 entities and a managed object context with many managed objects configured by those entities.</em></p> <p>A tableview may display only the data from the instances configured to one entity (that is most common) but the actual data and the insertions and deletion happen to managed object instances and not the entities which are unalterable by that point. </p> <p>However, I don't think the terminology confusion is the actual cause of your problem. Instead, I think the error is trying to tell you that you are deleting an object configured by EntityA from a <strong><em>required</em></strong> relationship with a an object configured with entityB. </p> <p>The cocoa error 1570 is a <a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/CoreDataFramework/Miscellaneous/CoreData_Constants/Reference/reference.html#//apple_ref/doc/uid/TP40003614-CH4g-SW13" rel="nofollow">NSValidationMissingMandatoryPropertyError</a> which as the name suggest occurs when you try to save a managed object that has a required property with a nil value. The manage object context tries to validate the object graph before it saves and when it finds a missing required property it throws that error. </p> <p>I can't tell you anything more because I have no idea what your data model looks like. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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