Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 删除行和表视图时崩溃_Objective C_Uitableview - Fatal编程技术网

Objective c 删除行和表视图时崩溃

Objective c 删除行和表视图时崩溃,objective-c,uitableview,Objective C,Uitableview,尝试使用以下命令删除tableview中的行时: [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:swipedIndexPath, nil] withRowAnimation:UITableViewRowAnimationFade]; 如果indexPath有效并给出了正确的单元格,我将获得以下崩溃日志: *** Assertion failure in -[UITableView _endCellAnimat

尝试使用以下命令删除tableview中的行时:

 [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:swipedIndexPath, nil] withRowAnimation:UITableViewRowAnimationFade];
如果indexPath有效并给出了正确的单元格,我将获得以下崩溃日志:

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-2903.23/UITableView.m:1330
不知道为什么?

请检查您的

(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
返回的值比调用“deleteRows..”之前的值小1


这可能是你的问题。如果要从tableview UI中删除一行,后端数据也应将其删除。

是否已更新数据源以删除该对象?您应该将数据源的删除和更新包装在tableView方法BeginUpdate和EndUpdate中