iOS删除tableView行时错误

错误提示:

Invalid update: invalid number of rows in section 0

详细错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'Invalid update: invalid number of rows in section 6. 
The number of rows contained in an existing section after the update (0) must be equal to the number of rows contained in that section before the update (9), 
plus or minus the number of rows inserted or deleted from that section (0 inserted, 3 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'

导致这个错误是因为要删除一行数据,但是呢,数据源没改动,所以一定要在删除行之前改变数据源。
PS:我出现此问题是因为,我的数据源是不可变数组,然后放到了可变数组中,操作可变数据,但是数据源还是没变,这样删除的时候就会出现这个错误。
出现这个错误,不会刷新走数据源代理,但是会检查数据源。

你可能感兴趣的:(iOS删除tableView行时错误)