title: How does deleteObject: work in coreData?
body: <p>I just took the plunge and rewrote my App on top of CoreData (previously I was using my own internal save format).</p>
  
  <p>Things are mostly working, although I'm a little confused by the behaviour of deleteObject:.</p>
  
  <p>I have an object that is part of my graph, and when I delete it nothing seems to happen to the object. The object has relationships where some of them are "Cascade" and some are "Nullify". Every relationship to / from the object has an inverse relationship.</p>
  
  <p>After I delete the object, the only thing that seems to change is that the "isDeleted" flag is set on my object. All of the relationships exist as they did before.</p>
  
  <p>If I try to find the objects using a NSFetchRequest, it does not find the deleted objects. However, if I traverse my graph using the KVC relationships, the NSSet returned contains all of the objects including the deleted objects.</p>
  
  <p>After I send the save: method to my ManagedObjectContext, then everything is as I expect.</p>
  
  <p>When I do a deletion, do I need to manually nil out relationships I don't want or do I need to continuously save to keep my data sane? This seems very counter intuitive to me.</p>
  
  <p>Is there anything that I can do to "commit" the deletion or at least make my object graph sane short of doing a save. It seems a little drastic to be doing a save every time I want to modify my graph.</p>
  
  <p>Thanks,
  Ron</p>
  
  <p>p.s. Here is some of the behaviour that seems strange to me:</p>
  
  <p>Before deleting the object, this is the "description" of the parent object which has a categoryObjs "to many" relationship:</p>
  
  <pre><code>categoryObjs =     (
      "0x613e1a0 &lt;x-coredata://1A1AE9E7-66B1-4F4D-A7AB-07D4504CAE2C/TestCategory/p9&gt;",
      "0x613e1b0 &lt;x-coredata://1A1AE9E7-66B1-4F4D-A7AB-07D4504CAE2C/TestCategory/p12&gt;",
      "0x613e190 &lt;x-coredata://1A1AE9E7-66B1-4F4D-A7AB-07D4504CAE2C/TestCategory/p7&gt;"
  );
  </code></pre>
  
  <p>After deleting the "p12" object (the middle one above), the state of the relationship does not change when accessed through KVC. If I try to fetch the TestCategory entities, then only two are found.</p>
  
  <p>After a "save:" the p12 object disappears:</p>
  
  <pre><code>categoryObjs =     (
      "0x613e1a0 &lt;x-coredata://1A1AE9E7-66B1-4F4D-A7AB-07D4504CAE2C/TestCategory/p9&gt;",
      "0x613e190 &lt;x-coredata://1A1AE9E7-66B1-4F4D-A7AB-07D4504CAE2C/TestCategory/p7&gt;"
  );
  </code></pre>