在PFQueryTableViewController中删除单元格和[self loadObjects]时,它在-[UITableView _endCellAnimationsWithContext:]中得到断言失败. [英] When delete cell and [self loadObjects] in PFQueryTableViewController, it gets Assertion failure in -[UITableView _endCellAnimationsWithContext:]
问题描述
我愿意删除单元格并在PFQueryViewController的单元格中显示重载tableView.
I am willing to delete cell and show reload tableView in cell of PFQueryViewController.
但是,当我删除并刷新TableView时,出现错误:"***-[UITableView _endCellAnimationsWithContext:],/SourceCache/UIKit_Sim/UIKit-3318.93/UITableView.m:1582中的断言失败"
But, when I delete and refresh TableView, I have get error:" *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-3318.93/UITableView.m:1582"
此错误代码之后,我检查了Parse中的数据,并删除了已删除单元格的数据.
After this error code, I check data in Parse, and the data of deleted cell is deleted.
我看了这个链接,但是我不确定为什么要在我的代码中声明. 当我使用[self loadObjects]时. https://parse.com/questions/refresh-data-in-a-pfquerytableviewcontroller
I watched this Link, but I am not sure why get assertion in my code. When I use [self loadObjects]. https://parse.com/questions/refresh-data-in-a-pfquerytableviewcontroller
if (editingStyle == UITableViewCellEditingStyleDelete) {
PFObject * object = [self.objects objectAtIndex: indexPath.row];
[object deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
[self loadObjects];
}else{
}
}];
能给我一些建议吗?
推荐答案
升级到较新的解析sdk后,我遇到了同样的问题.不知道确切的版本,但是这是我解决断言失败的方法,只需在loadObjects
之后调用reloadData
:
I had the same problem, after upgrading to a newer parse sdk. Don't know what version exactly, but here's how I solved my Assertion Failure, simply by calling reloadData
after loadObjects
:
PFObject * object = [self.objects objectAtIndex: indexPath.row];
[object deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
[self loadObjects];
[self.tableView reloadData];
}else{
//handle your error
}
}];
这篇关于在PFQueryTableViewController中删除单元格和[self loadObjects]时,它在-[UITableView _endCellAnimationsWithContext:]中得到断言失败.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!