title: How can I make deleteRowsAtIndexPaths: work with GenericTableViewController?
body: <p>I'm using Matt Gallagher's <code>GenericTableViewController</code> idea for controlling my <code>UITableViews</code>. My datasource is a <code>NSFetchedResultsController</code>.</p>
  
  <p><a href="http://cocoawithlove.com/2008/12/heterogeneous-cells-in.html" rel="noreferrer">http://cocoawithlove.com/2008/12/heterogeneous-cells-in.html</a></p>
  
  <p>Everything is working fine, until I try to delete a cell.</p>
  
  <p>I have the following code in my View Controller:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
  
    if (editingStyle == UITableViewCellEditingStyleDelete) {
  
          // Delete the managed object.
          NSManagedObjectContext *context = [wineryController managedObjectContext];
          [context deleteObject:[wineryController objectAtIndexPath:indexPath]];
  
          NSError *error;
          if (![context save:&amp;error]) {
              // Handle the error.
          }
          [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   
  }
  </code></pre>
  
  <p>The final line crashes with the rather verbose explanation in the console:  </p>
  
  <pre>*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',  
  reason: 'Invalid update: invalid number of rows in section 0.  The number of rows   
  contained in an existing section after the update (5) must be equal to the number  
  of rows contained in that section before the update (5), plus or minus the number  
  of rows inserted or deleted from that section (0 inserted, 1 deleted).'</pre>
  
  <p>OK, I understand what it is saying... a row is not getting deleted (I would assume) because I'm not forwarding some message to the right place (since I have moved some code from its 'normal' location)... anyone have any idea which one? I am totally stumped on this one.</p>