PDA

View Full Version : NSInternalInconsistencyException in UITableView




idelovski
Mar 2, 2012, 03:47 PM
I had experienced this exception 3 times so far in two months and I can't find the cause. I happens very rarely and never when I'm hunting for it. The full text from console:

Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-984.38/UITableView.m:774
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 (49) must be equal to the number of rows contained in that section before the update (48), plus or minus the number of rows inserted or deleted from that section (1 inserted, 1 deleted).'

The thing is I am not inserting or removing items from the TableView. I don't even have a single call to deleteRowsAtIndexPaths:withRowAnimation: or insertRowsAtIndexPaths:withRowAnimation: in my entire project.

On the other hand, I have some NSOperations active in the view that precedes the table view in navigation hierarchy so they somehow might affect the arrays used to form the table view, but all those operations perform changes to those arrays in the main thread. Plus, all the operations are stopped as I navigate out of the root view.

So, my first question is about the message above. Does that mean I increased or decreased number of elements? Or both?!

Like I said, I got it only a few times in a couple of months but when it happens it happens when I enter the second view containing the table and if I immediately start dragging the table. When it stops I have a crash. In a way it is repeatable. I just have to try it enough times.