Closed lemon4ex closed 7 years ago
解决方法:
替换
NSInteger rowCount = [self.modelTableview numberOfRowsInSection:section];
为
NSInteger rowCount = [self.modelTableview.dataSource tableView:self.modelTableview numberOfRowsInSection:section]
应该是UIKit的bug吧
问题很奇怪,进入控制器时,如果数据源为0,这个时候直接添加数据没有问题 如果此时将数据全部删除(使用deleteRowsAtIndexPaths删),这时候再重新添加数据,就会导致内存爆炸💥导致闪退,代码出在这里:
rowCount此时为一个无穷大的数,而不是0,这导致下面添加了无穷多的[NSNull null],导致内存爆炸,闪退。rowCount为毛不是0,不得而知,系统bug?
添加数据的代码
移除数据代码