简体   繁体   English

无效的更新:部分中的行数无效

[英]Invalid update: invalid number of rows in section

I'm getting this error message which I can't figure out what to do or how to debug: 我收到此错误消息,无法弄清楚该怎么做或如何调试:

'Invalid update: invalid number of rows in section 1. The number of rows contained in an existing section after the update (7) must be equal to the number of rows contained in that section before the update (7), 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).' '无效更新:第1节中的行数无效。更新(7)之后,现有节中包含的行数必须等于更新(7)前该节中包含的行数,再加上或减去从该部分插入或删除的行数(插入0,已删除1),加上或减去移入或移出该部分的行数(移入0,移出0)。

I have 3 sections in my table. 我的桌子上有3个部分。 Here's the number of rows in each section before anything changes to my data source happens: 这是对我的数据源进行任何更改之前每个部分中的行数:

// Check current data source
date source for section 0: 1 items
data source for section 1: 8 items
data source for section 2: 8 items

sections count: 3
section 0 1 rows
section 1 8 rows
section 2 8 rows

Here are what prints out after I delete a row from section 1 and I want to move it to section 2: 这是我从第1部分删除一行并将其移至第2部分后输出的内容:

// Updated my date source
date source for section 0: 1 items
data source for section 1: 7 items
data source for section 2: 9 items

sections count: 3
section 0 1 rows
section 1 7 rows
section 2 9 rows

// Then the crash message happen

Please help. 请帮忙。 Thanks. 谢谢。

You need to remove the object from your data array before you call deleteRowsAtIndexPaths:withRowAnimation. 在调用deleteRowsAtIndexPaths:withRowAnimation之前,需要从数据数组中删除对象。

Basically the same question in stackoverflow 基本相同的问题在stackoverflow

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无效更新:第0部分UITableView中的行数无效 - Invalid update: invalid number of rows in section 0 UITableView NSInternalInconsistencyException(无效更新:第0部分无效的行数) - NSInternalInconsistencyException(Invalid update: invalid number of rows in section 0) 无效的更新:iOS中第0部分的无效行数 - Invalid update: invalid number of rows in section 0 in iOS iOS 5:更新无效:部分中的行数无效 - ios 5: Invalid update: invalid number of rows in section 无效的更新:部分中的行数无效 - Invalid update: invalid number of rows in section '无效更新:第 0 节中的行数无效 - 'Invalid update: invalid number of rows in section 0 无效更新:使用 NSFetchedResultsController 的第 0 节中的行数无效 - Invalid update: invalid number of rows in section 0 with NSFetchedResultsController iOS:无效更新:第 0 节中的行数无效 - iOS: Invalid update: invalid number of rows in section 0 NSInternalInconsistencyExceptionException原因:'无效的更新:部分0中的行数无效' - NSInternalInconsistencyException reason: 'Invalid update: invalid number of rows in section 0' 核心数据示例,无效更新:第 0 节中的行数无效 - Core Data example, Invalid update: invalid number of rows in section 0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM