周五上午,测试,有bug:每次reset模拟器后,第一次进入界面,闪退,第二次进入界面,结果正常。
以下是这个bug的错误日志:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 1. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).’
发现刷新列表时,闪退。问题出在:[self.tableViewreloadSections:[NSIndexSetindexSetWithIndex:2]withRowAnimation:UITableViewRowAnimationNone];
这个方法我没用过,从方法名看出,这个方法是局部刷新列表的某个section。但一般我都是用reloadData,刷新整个列表。于是,我把reloadSection改回reloadData,发现这个两个bug都不再出现了。
按道理,使用reloadSection应该没有问题啊,但为什么这里不能使用reloadSection呢?