title: NSFetchedResultsController update/insert removing cell from UITableview
body: <p>Using <code>NSFetchedResultsController</code> to auto update <code>UITableview</code> but facing some issue. When trying to add/edit from another device the whole cell is vanished every time.</p>
  
  <p>Here is the bunch of code</p>
  
  <pre><code>// NSFetchedResultsController Delegate methods
  
  - (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
  {
      [self.aTableView beginUpdates];
  }
  
  - (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id &lt;NSFetchedResultsSectionInfo&gt;)sectionInfo
             atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
  {
      UITableView *tableView = self.aTableView;
  
      switch(type) {
          case NSFetchedResultsChangeInsert:
              [tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
              break;
  
          case NSFetchedResultsChangeDelete:
              [tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
              break;
  
          default:
              return;
      }
  }
  
  - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
         atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
        newIndexPath:(NSIndexPath *)newIndexPath
  {
      UITableView *tableView = self.aTableView;
  
      switch(type) {
          case NSFetchedResultsChangeInsert:
              [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
              break;
  
          case NSFetchedResultsChangeDelete:
              [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
              break;
  
          case NSFetchedResultsChangeUpdate:
              if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0"))
                  [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
              else
                  [tableView reloadData];
              break;
  
          case NSFetchedResultsChangeMove:
              [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
              [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
              break;
      }
  }
  
  - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
  {
      [self.aTableView endUpdates];
  }
  
  // Fetch data from coredata
  
  -(NSFetchedResultsController *)loadForumData {
  
  if (_fetchedForumController != nil) {
      return _fetchedForumController;
  }
  
  NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
  NSEntityDescription *entity = [NSEntityDescription entityForName:@"SocialWall" inManagedObjectContext:self.managedObjectContext];
  [fetchRequest setEntity:entity];
  
  NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"dateTime" ascending:NO];
  [fetchRequest setSortDescriptors:[[NSArray alloc] initWithObjects:sortDescriptor, nil]];
  
  NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(eventId == %@)",self.appDelegate.currentEvent.entityId];
  [fetchRequest setPredicate:predicate];
  
  fetchRequest.fetchLimit = _range+10;
  fetchRequest.fetchOffset = 0; // start range
  
  NSFetchedResultsController *theFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:nil];
  [theFetchedResultsController setDelegate:self];
  
  _fetchedForumController = theFetchedResultsController;
  [_fetchedForumController performFetch:nil];
  return _fetchedForumController;
  
  }
  </code></pre>
  
  <p>Here is the o/p what i'm getting on device/simulator after editing the cell . Please check the attached simulator screenshort - <a href="http://i.stack.imgur.com/LUMPh.png" rel="nofollow">http://i.stack.imgur.com/LUMPh.png</a></p>