Why does my app crash when I add an row to the table view?
Posted
by mystify
on Stack Overflow
See other posts from Stack Overflow
or by mystify
Published on 2010-04-17T19:42:10Z
Indexed on
2010/04/17
20:33 UTC
Read the original article
Hit count: 300
iphone
|uitableview
I'm adding a row like this, when a button is pressed. It must be the very first row in the first section:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
I don't call anything else here. No -reloadData. I keep getting this:
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (6) must be equal to the number of rows contained in that section before the update (6), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted).'
© Stack Overflow or respective owner