错误: The number of sections contained in the table view after the update (1) must be equal to the number of sections contained in the table view before the update (2), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).
功能思路其实不难,
交代一下,我自己要实现的效果:
1.TableView是分组的。
2.点击删除按钮后,某行被删除。
写完大概功能,运行之后,
出现:
*** Assertion failure in -[UITableView _endCellAnimationsWithCon
libc++abi.dylib: handler threw exception
原因:
1.在调用deleteRowsAtIndexPaths:方法前,要确保数据为最新。也就是说,先将要删除的数据从数据源中删除。
2.分组和分组中行数是变动的,不能写成死的!
3.如果是分组,你会发现很怪的现象:当一个分组中,有多条数据时,你删除其中一条,正确;当一个分组中,你要删除唯一的一条时,仍然会报出如上的错误!
本人,就是百思不得其解。反复调试,数据已经保持最新了的。
在网上搜了很多,却没有满意答案。