Checklists: Crash at tableView.insertRowsAtIndexPaths

Hi,

I’m having trouble with adding a new cell to the table view.

I get the following message: ‘NSInternalInconsistencyException’, reason: ‘attempt to insert row 5 into section 0, but there are only 5 rows in section 0 after the update’

I’m pretty sure I might have an “off by one” array type error.

I have made sure that the action is correctly wired up.
I’ve used breakpoints to narrow it down, it crashes on this line:
tableView.insertRowsAtIndexPaths(indexPaths, withRowAnimation: .Automatic)

Has anyone else had this problem when doing this chapter?

I am on page 66.

Cheers,
Julz

You need to insert into the model before you call -insertRowsAtIndexPaths:withRowAnimation:
Are you sure you are calling the insert before then?