title: didChangeObject: not called of NSFetchedResultsController
body: <p>I have nearly tried everything but cannot figure out what is wrong. I have a NSFetchedResultsController and fetch some posts out of core data. Then I have a method where I insert new posts into the same context and save the context. Normally, the didChangeObject: method should be called now, but it does not. I have a similar view controller where I do basically the same on a different table (=nsmanaged object) and there the didChangeObject: method gets called successfully.</p>
  
  <p>What I have tried so far:</p>
  
  <ul>
  <li><p>Created another context just for this view controller</p></li>
  <li><p>Removed the cache of the NSFetchedResultsController </p></li>
  </ul>
  
  <p>The following method fetches the data out of the core data db and 'stores' it into the NSFetchedResultsController (variable: <code>controller</code>).</p>
  
  <pre><code>//reloading newsgroups from coredata
  - (void)reloadNewsgroupsFromCoreData
  {    
      //creating fetch request
      NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Post"];
  
      //sorting by transient date (hour and secons cutted off)
      NSSortDescriptor *sortByDate = [[NSSortDescriptor alloc] initWithKey:@"dateCreatedTransient" ascending:NO];
      NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortByDate, nil];
      [fetchRequest setSortDescriptors:sortDescriptors];
  
      //where clause
      [fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"ref_subscribed_newsgroup == %@ AND references == nil", self.newsgroup]];
  
      //setting fetchrequest
      self.controller = [[NSFetchedResultsController alloc]
                         initWithFetchRequest:fetchRequest
                         managedObjectContext:self.context
                         sectionNameKeyPath:@"dateCreatedForSections"
                         cacheName:nil]; //todo, maybe add a cache here!
  
      //fetch
      NSError *error;
      [self.controller performFetch:&amp;error];
  
      if (error) {
          NSLog(@"%@", error);
      }
  }
  </code></pre>
  
  <p>Furthermore, according to the documentation I set the delegate of the NSFetchedResultsController to my view controller (this is the same where the aforementioned fetch method is located).</p>
  
  <p>In <code>viewDidLoad</code>:</p>
  
  <pre><code>self.controller.delegate = self;
  </code></pre>
  
  <p>Then I have implemented the methods from the protocol, also the <code>didChangeObject:</code></p>
  
  <pre><code>- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath {    
      UITableView *tableView = self.tableView;   
  
    // I HAVE ADDED A BREAKPOINT HERE BUT IT NEVER STOPS HERE.
  
      switch(type) {
  
          case NSFetchedResultsChangeInsert:
              [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
  
              break;
          case NSFetchedResultsChangeDelete:
              [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
              break;
  
          case NSFetchedResultsChangeUpdate:
              [self configureCell:[tableView cellForRowAtIndexPath:indexPath]
                      atIndexPath:indexPath];
  
              break;
  
          case NSFetchedResultsChangeMove:
              [tableView deleteRowsAtIndexPaths:[NSArray
                                                 arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
              [tableView insertRowsAtIndexPaths:[NSArray
                                                 arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
              break;
      }
  
  }
  </code></pre>
  
  <p>Then I have another method that stores some posts into core data. I think this is important: This method is invoked via a delegate from another thread. (The server connection invokes it using <code>performSelectorOnMainThread:...</code>)</p>
  
  <pre><code>- (void)storeIntoCoreData:(NSArray*)postsArray
  { 
  ...
          Post *entity = [NSEntityDescription insertNewObjectForEntityForName: @"Post" inManagedObjectContext:context];
  
          entity.inReply = dummy.in_reply;
          entity.body = dummy.body;
          entity.email = dummy.email;
          entity.from = dummy.from;
          entity.messageIdentifier = dummy.message_identifier;
          entity.references = dummy.references;
          entity.subject = dummy.subject;
          entity.dateCreated = dummy.date;
          entity.unread = [NSNumber numberWithInt:1];
  ...
      [self.context save:&amp;error];
      if (error)
      {
          NSLog(@"error: %@", error);
      }
  
  // IMPORTANT: CURRENTLY I AM CALLING THIS METHOD AGAIN HERE, WHICH 
  // FETCHES ALL POSTS OUT OF CORE DATA.
  // THIS IS SO UGLY AND NOT PERFORMANT. 
  // THEN I INVOKE RELOADDATA ON THE TABLEVIEW TO RELOAD THE ENTIRE TABLE
  // BUT THERE WAS JUST ONE INSERT SO A ENTIRE RELOAD WOULD NOT BE NECESSARY. 
      [self reloadNewsgroupsFromCoreData];
      [self.tableView reloadData];
  
  // I HAVE TO DO THIS BECAUSE THE didChangeObject METHOD GETS NOT CALLED.
  }
  </code></pre>
  
  <p>Does anyone have a hint or a suggestion what could be wrong?</p>
  
  <p>Thanks and regards,
  Chris</p>