SAH*_*AHM 5 debugging core-data objective-c uitableview ios
我之前没有看过这个错误,我搜索了为什么它可能发生但找不到任何信息:
CoreData:错误:严重的应用程序错误.在调用-controllerDidChangeContent:期间,从NSFetchedResultsController的委托中捕获到异常.UITableView内部错误:无法生成具有旧节数的新节映射:1和新节数:0与userInfo(null)
有谁知道这里会发生什么?我不确定"内部错误"部分 - 此错误是否表示我的代码存在问题或UITableView中存在错误?
斯蒂芬已经在对原始问题的评论中提到了这一点,但我认为值得分享一些代码。这个答案实际上来自用户GERUB在苹果开发论坛上的一个线程上发表的评论: https: //forums.developer.apple.com/thread/9964
if tableView.numberOfRowsInSection(indexPath.section) == 1{
tableView.deleteSections(NSIndexSet(index: indexPath.section), withRowAnimation: .Automatic)
}else{
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
Run Code Online (Sandbox Code Playgroud)
我已经在方法实现内部对此进行了测试NSFetchedResultsControllerDelegate,它运行得很好。
| 归档时间: |
|
| 查看次数: |
1452 次 |
| 最近记录: |