I often see this when my count is not correct. Based on this:
reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (7), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
I'm guessing that your table had 7 elements in it (as reported by tableView:numberOfRowsInSection:
) was returning 7 and now is returning 1. Which leads me to belive you think calling
[self.myTableView beginUpdates];
[myTableView endUpdates];
Is sufficient when you are removing rows.
But you need to tell you UITableView what rows are being removed (or added) first. This will depend on your exact situation, but if you wanted to remove the first seven rows of section zero it would look like this.
NSMutableArray *indexes = [[NSMutableArray alloc] init];
for (int i = 0; i <= 6; i++)
{
[indexes addObject:[NSIndexPath indexPathForItem:i inSection:0]];
}
[myTable beginUpdates];
[myTable deleteRowsAtIndexPaths:indexes withRowAnimation:NO];
[myTable endUpdates];
Also as @Marco said, just use the same pointer to your table otherwise it's a bit confusing, which I did in my example.
Or if you just wanted to tell you table to completly reload you can just call reloadData instaed.
[myTable reloadData];
I think this would be less efficient then the other way of manually specify which rows are being added or removed, but in a table of 7 I think it would be fine.