Dealing with NSInternalInconsistencyException when removing UITable row

Stupid situation, today I wanted to test deleteRowsAtIndexPaths method from UITable withRowAnimation:UITableViewRowAnimationFade – just to check how it will look, did not wanted to remove my db record and add it every run, but always I was getting:

The reason was simple – in my array I still had removed entry and it caused such exception. So if you want to test something and don’t want to remove db record, you need to remove it at least from array where UITable data is stored, in my case:

just helped, and in case anyway will look for a way to remove table row while having only its index:

And thats all, you don’t need (or even you cannot) use reloadData method. Of course if your table has sections, you need to put proper value as “inSection” argument. The simples and most elegant way is to extend UITableViewCell and add your properties for holding row and section:

 

Leave a Reply