title: Dynamically changing data source causing deleteRowsAtIndexPaths:indexes to crash
body: <p>Tearing my hair out trying to get this to work. I want to perform <code>[self.tableView deleteRowsAtIndexPaths:indexes withRowAnimation:UITableViewRowAnimationLeft];</code>, </p>
  
  <p>More detailed code of how I delete:</p>
  
  <pre><code>int index =  (int)[self.messages indexOfObject:self.messageToDelete];
  
  
  [self.messages removeObject:self.messageToDelete];
  
  NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0];
  NSArray *indexes = [[NSArray alloc] initWithObjects:indexPath, nil];
  
  [self.tableView deleteRowsAtIndexPaths:indexes withRowAnimation:UITableViewRowAnimationLeft];
  </code></pre>
  
  <p>This works fine however if I get a push notification (i.e a new message received) whilst deleting the app will crash and display an error like: </p>
  
  <blockquote>
    <p>Assertion failure in -[UITableView _endCellAnimationsWithContext:],
    /SourceCache/UIKit/UIKit-3347.44/UITableView.m:1327
        2015-07-04 19:12:48.623 myapp[319:24083] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:
    'attempt to delete row 1 from section 0 which only contains 1 rows
    before the update'</p>
  </blockquote>
  
  <p>I suspect this is because my data source is changing, the size of the array that</p>
  
  <pre><code> -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  </code></pre>
  
  <p>references while deleting won't be consistent because it was incremented by one when the push notification triggered a refresh. Is there any way I can work around this? Am I correct that <code>deleteRowsAtIndexPaths</code> uses the <code>numberOfRowsInSection</code> method?</p>