Hey guys,
The following code is called with lastRemoved and lastAdded being:
data lastRemoved:
(
)
data lastAdded:
(
<NSIndexPath 0x4b2cf60> 2 indexes [0, 9]
)
Then I get a NSRangeException:
"* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableIndexSet addIndexesInRange:]: Range {2147483647, 1} exceeds maximum index value of NSNotFound - 1'"
My question is why I get that exception. How does it get that weird NSIndexPath? As you can see I don't pass it.
- (void) updateTableview {
UITableView * tv = tableViewController.tableView;
[tv beginUpdates];
NSLog(@"data lastRemoved:\n%@", [[data lastRemoved] description]);
NSLog(@"data lastAdded:\n%@", [[data lastAdded] description]);
[tv insertRowsAtIndexPaths: [data lastAdded] withRowAnimation: UITableViewRowAnimationFade];
[tv deleteRowsAtIndexPaths: [data lastRemoved] withRowAnimation: UITableViewRowAnimationFade];
[tv endUpdates];
}
I have a hunch that it's because I'm adding a row at index 9 but I only have 3 rows. Can anyone confirm this?