1
votes

I am willing to delete cell and show reload tableView in cell of PFQueryViewController.

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"

After this error code, I check data in Parse, and the data of deleted cell is deleted.

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{
         }
     }];

Could you please give me some advice ?

1
You should include more of the actual error message - there should be more information than assertion failure.luk2302
Thank you for the reply. I can only get this error code as I wrote. 2015-07-12 01:18:35.347 ParseStarterProject[19979:4424938] Warning: A long-running operation is being executed on the main thread. Break on warnBlockingOperationOnMainThread() to debug. 2015-07-12 01:18:36.098 ParseStarterProject[19979:4424938] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-3318.93/UITableView.m:1582Yaemon
So did you set a breakpoint on warnBlockingOperationOnMainThread()?Hot Licks

1 Answers

8
votes

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
     }
 }];