NSInternalInconsistencyException: "Invalid update: invalid number of rows in section 0"

After adding deletion to a UITableView in an iOS application  (which is usually pretty straightforward), I got an 


NSInternalInconsistencyException: "Invalid update: invalid number of rows in section 1" 

where the counts were somewhat strange (inserted 0, deleted 0). After disabling the deletion of the elements from the underlying array, I got 

NSInternalInconsistencyException: "Invalid update: invalid number of rows in section 0" 

where the counts were what I expected (inserted 0, deleted 1).  Turns out I had implemented 

numberOfSectionsInTableView()

to return 2; changing this to return 1 fixed the error.


137 Words

2014-12-21T14:34:00-08:00