title: Core Data: Keypath "objectID" not found in entity
body: <p>I'm using <code>NSFetchedResultsController</code> with a predicate to load a list of <code>Documents</code> in my application. I want to load all the <code>Documents</code> except the currently active one.</p>
  
  <p>I am using Rentzsch's <a href="http://rentzsch.com/code/mogenerator" rel="noreferrer">MOGenerator</a> to create a <code>_Document</code> class and then I put all my custom code in the <code>Document</code> subclass. <code>_Document</code> generates an <code>objectID</code> property with type <code>DocumentID</code>.</p>
  
  <p>In the class that creates the controller, I set the controller's <code>currentDocID</code> property:</p>
  
  <pre><code>controller.currentDocID = self.document.objectID;
  </code></pre>
  
  <p>In the controller itself, I lazy load the fetchedResultsController like this:</p>
  
  <pre><code>- (NSFetchedResultsController *)fetchedResultsController {
      if (fetchedResultsController != nil) {
          return fetchedResultsController;
      }
  
      NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
      NSEntityDescription *entity = [NSEntityDescription entityForName:@"Document" inManagedObjectContext:managedObjectContext];
      [fetchRequest setEntity:entity];
  
      NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(objectID != %@)", self.currentDocID];
      [fetchRequest setPredicate:predicate];
  
      NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"dateModified" ascending:NO];
      NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
  
      [fetchRequest setSortDescriptors:sortDescriptors];
  
      NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:nil cacheName:@"Root"];
      aFetchedResultsController.delegate = self;
      self.fetchedResultsController = aFetchedResultsController;
  
      [aFetchedResultsController release];
      [sortDescriptor release];
      [sortDescriptors release];
  
      return fetchedResultsController;
  }
  </code></pre>
  
  <p>When the fetchedResultsController loads, my app crashes with an unhandled exception:</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath objectID not found in entity &lt;NSSQLEntity Document id=1&gt;'
  </code></pre>
  
  <p>It's my understanding that all NSManagedObjects have an objectID, whether temporary or permanent. Is this not the case? Any thoughts?</p>