cuốn sách gpt4 ai đã làm

ios - Sửa lỗi NSInternalInconsistencyException

In lại Tác giả: Walker 123 更新时间:2023-11-28 15:23:58 31 4
mua khóa gpt4 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)

} khác {

}
}

错误:

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).

Làm thế nào tôi có thể giải quyết vấn đề này?

câu trả lời hay nhất

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

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

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

祝你好运! :)

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

31 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress