【发布时间】:2015-09-07 12:09:44
【问题描述】:
我正在使用带有本地数据存储的 PFQueryTableViewController。我想让用户使用以下代码从表中删除一个对象:
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
PFObject * object = [self.objects objectAtIndex: indexPath.row];
[object deleteInBackgroundWithBlock: ^ (BOOL succeeded, NSError * error) {
[self loadObjects];
}];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
我明白了 *** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无效更新:第 0 节中的行数无效。更新 (2) 后现有节中包含的行数必须等于行数更新前包含在该节中 (2),加上或减去从该节插入或删除的行数(0 插入,1 删除),加上或减去移入或移出该节的行数(0 移入, 0 移出)。'
我认为,这是在 PFQueryTableViewController 中使用的注释,但我找不到解决方案。 非常感谢。
【问题讨论】:
标签: ios parse-platform