title: Question about UITableView and deleteRowsAtIndexPaths
body: <p>My first question on stackoverflow (&lt;&lt; n00b). I'm working on my first project involving UITableViews and plists, and I'm having an issue.</p>
  
  <p>The property list consists of a dictionary holding 3 sections/categories (each an array) and a number of entries in each of these.</p>
  
  <p>The lists load just fine. The problem doesn't occur until I try making it possible to delete individual entries from the list.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView commitEditingStyle:    (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
  
  if (editingStyle == UITableViewCellEditingStyleDelete) {
  
      //make array of the objects and remove the selected object from that array.
      NSMutableArray *delArray = [faves objectForKey:[entries objectAtIndex:indexPath.section]];
      [delArray removeObjectAtIndex:indexPath.row];
  
      //set entries to the value of the array, now sans the removed object.
      self.entries = delArray;
      [delArray release];
  
      //write the updated entries to the plist file.
      NSArray *rootPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *docsPath = [rootPath objectAtIndex:0];
      NSString *plistFile = [docsPath stringByAppendingPathComponent:@"Data.plist"];
      [faves writeToFile:plistFile atomically:YES];
  
      //update the actual tableview. This is where things go awry.
      [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; //ends up trying to load the sections instead of the entries = wrong number of list items returned = crash!
  
      //[tableView reloadData]; //works if I only use this line, but the list updates wrong, showing each entry as a section header.
      }
  }
  </code></pre>
  
  <p>The entry IS deleted from the plist correctly, but the table fails to update right and causes the app to crash. I've included the error code below.</p>
  
  <pre><code>2011-09-23 18:40:19.732 MyApp[10314:b303] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1448.89/UITableView.m:974
  2011-09-23 18:40:19.734 MyApp[10314:b303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections.  The number of sections contained in the table view after the update (5) must be equal to the number of sections contained in the table view before the update (3), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).'
  </code></pre>
  
  <p>The first number (5) is consistent with how many records are supposed to be left in the affected category, but the second number (3) refers to the number of categories. Like I said above, the entry is deleted from the plist - just not the table.</p>