title: UITableView endUpdates crash when called in viewDidLoad
body: <p>I have a UITableView and I want to modify it in viewDidLoad of my view controller.
  But UITableView does not query its dataSource in viewDidLoad so I call reloadData first and then I modify its cells with beginUpdates and endUpdates. (In my case I'm just deleting some cells).
  But when endUpdates is called it throws an exception: </p>
  
  <blockquote>
    <p>[__NSArrayM insertObject:atIndex:]: index 1 beyond bounds for empty array.</p>
  </blockquote>
  
  <p>what does this exception mean?
  I know that I am returning correct numbers to UITableView because if I call it after viewDidAppear it works perfectly, it just doesn't work in viewDidLoad.</p>
  
  <p><strong>EDIT :</strong> </p>
  
  <p>here's my code</p>
  
  <pre><code>for (int i = 0; i &lt; [customDataSource numberOfSectionsInTableView]; i ++) {
      NSInteger n = [customDataSource tableView:self numberOfRowsInSection:section];
      NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity:n];
      for (NSInteger i = 0; i &lt; n; i++)
          [array addObject:[NSIndexPath indexPathForRow:i inSection:section]];
      [super beginUpdates];
      [super deleteRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationNone];
      [super endUpdates];
  }
  </code></pre>
  
  <p>when i move this code from viewDidAppear to viewDidLoad or viewWillAppear it will crash.</p>