UITableView crashes after trying to delete a cell the *second* time?

It's likely that an NSInternalInconsistencyException is being raised (check your console) You need to ensure that when tableView:numberOfRowsInSection: is called on your UITableViewDelegate the count is correct for the section of the cell that was deleted via deleteRowsAtIndexPaths:withRowAnimation: i.e. If there were 10 elements in section 0 and you delete one of them via deleteRowsAtIndexPaths:withRowAnimation: tableView:numberOfRowsInSection: must return 9 for section 0.

It's likely that an NSInternalInconsistencyException is being raised (check your console). You need to ensure that when tableView:numberOfRowsInSection: is called on your UITableViewDelegate, the count is correct for the section of the cell that was deleted via deleteRowsAtIndexPaths:withRowAnimation:. I.e.

If there were 10 elements in section 0 and you delete one of them via deleteRowsAtIndexPaths:withRowAnimation:, tableView:numberOfRowsInSection: must return 9 for section 0.

I've tested for that, but it doesn't seem to be the problem - please see the updated post. – Hans Engel Sep 21 '09 at 23:57 You'll need to be more specific about the crash that's occurring (stack-trace, console output etc. ). – Nathan de Vries Sep 22 '09 at 2:15 I'm sorry, I should've thought to include that earlier.. I've updated the original post with the stack trace.

There is no error, however, output to the console. Anyway.. looks like the culprit is UITableView dequeueReusableCellWithIdentifier:. I searched a bit on Google for any previous encounters with this method, but couldn't find anything.. I've updated the original post, also, with the method that is calling dequeueReusableCellWithIdentifier:.

– Hans Engel Sep 22 '09 at 23:18 Hm, well, I'm not too sure what happened there, but it seems to have fixed itself somehow. I'll post again if the problem returns. – Hans Engel Sep 23 '09 at 3:03.

I have a UITableView which contains a custom UITableViewCell. This table gets its data from a mutable array, which in turn pulls it from a Core Data storage. The problem: If I enter editing mode and delete a cell, it works for the first time - the cell is successfully removed from the UITableView and the Core Data database.

However, if I attempt to delete another cell, the application crashes after clicking the Delete button for the row (the one that actually fires the action, not the button that rotates itself to reveal its partner). I tracked down the problematic method to find deleteRowsAtIndexPaths:withRowAnimation: was (surprisingly) the culprit. I have tried exiting the editing mode, visiting another view, and revisiting this table to delete another, but this didn't work, either.

Update: I have added a test to ensure that an incorrect row value is not given to the UITableView after deleting an element, causing it to crash. So, after looking through the stack trace, it looks like dequeueReusableCellWithIdentifier: has something to do with this problem, too. Here is the code that calls that method, though I don't see anything wrong with this, either..

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions