title: Core Data Inverse Relationship Not Being Set
body: <p>I've got two Entities that I'll call A and B.   They are configured with To-Many relationships in both directions, so A.myBs and B.myAs are both NSSets.   </p>
  
  <p>Here is my bizarre problem.   </p>
  
  <p>When I add a B to my A entity, I do it using the mutableSetValueForKey like this:</p>
  
  <pre><code>NSMutableSet *myBSet = [myA mutableSetValueForKey:@"myBs"];
  [myBSet addObject:theBtoAdd];
  </code></pre>
  
  <p>This does add the theBtoAdd to the A entity but does not add the inverse relationship.   Core Data context save doesn't kick any errors, but my A object doesn't have the B inverse set.  If I exit the application, even the partial relationship isn't saved.</p>
  
  <p>Here's the strange part... if I just switch my code around and do the opposite (there are reasons why this is harder to do for my particular application) - add A to B instead of adding B to A like this:</p>
  
  <pre><code>NSMutableSet *myASet = [myB mutableSetValueForKey:@"myAs"];
  [myASet addObject:theAtoAdd];
  </code></pre>
  
  <p>It works just fine.   By the way, I have plenty of other to-many relationships that work.   Just this one doesn't.   </p>
  
  <p>Couple of other things:
  1) My core data object model looks good, but this is the first new entity that I've added under Xcode 4
  2) I've check, rechecked and gone blind looking at my custom NSManagedObjects, but they look fine - declared dynamic, NSSet, no conflicting setters/getters... etc.</p>
  
  <p>Any help or debugging suggestions would be greatly appreciated.  Thank you!</p>