gpt4 book ai didi

ios - NSInternalInconsistencyException 修复

转载 作者:行者123 更新时间:2023-11-28 15:23:58 30 4
gpt4 key购买 nike

更新方法:

override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
initialData[indexPath.section].remove(at: indexPath.row)

tableView.deleteRows(at: [indexPath], with: .fade)

} else {

}
}

错误:

reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (2) 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, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

我该如何解决这个问题?

最佳答案

非常仔细地阅读您的控制台告诉您的内容。

您的数据源提示说,在您使用 removeAtIndexPaths() 删除一行后,它没有预期的行数。

确保您在删除/添加的内容以及相应更改的数据源中保持完整性。此外,请确保在主队列上进行这些更改。

祝你好运! :)

关于ios - NSInternalInconsistencyException 修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45538966/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com