title: Core Data Null Relationship
body: <p>I have a to-one relationship in my data model with Core Data. I'm trying to set the value of the relationship but Core Data keeps thinking that it's nil. The "creatorUser" relationship is <strong>not optional</strong>, so when I go to save my managed object context, Core Data gives errors because it thinks the "creatorUser" is nil. </p>
  
  <p>Any help would be greatly advised.</p>
  
  <pre><code>NSManagedObject *teamManagedObject = [NSEntityDescription insertNewObjectForEntityForName:@"DCTeam" inManagedObjectContext:_managedObjectContext];
  // Creator Properties
  NSManagedObject *creator = [self userForID:[ticketInfo objectForKey:@"userid"]];
  if (!creator) {
      creator = [NSEntityDescription insertNewObjectForEntityForName:@"DCUser" inManagedObjectContext:_managedObjectContext];
  
      [creator setValue:[personInfo objectForKey:@"userid"] forKey:@"userid"];
      [creator setValue:[personInfo objectForKey:@"creatorName"] forKey:@"name"];
  }
  
  [teamManagedObject setValue:creator forKey:@"creatorUser"];
  </code></pre>