Deleting row in Checklist application

Hello, I did the Checklist application which is great!

I also was able to add a search bar to it based on the Chocolate example. So far everything is working fine. I’m getting an error in

override func tableView(tableView: UITableView, commitEditingStyle editingStyle

if I try to delete a filtered record (it´s woking fine if I delete a row without filter)
This is the error I’m getting

NSInternalInconsistencyException’, reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (43) must be equal to the number of rows contained in that section before the update (43), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

Could you please include this kind of situation in your tutorial? :slight_smile:

Regards

When this happens it means you told the table view it now has one less row, but you did not change the data model to actually remove the row from the array. So now the table view is confused: you told it that a row was deleted but nothing seems to have changed…

Its a very common mistake :slight_smile: