Assertion failure in -[UITableView _endCellAnimationsWithContext:]

前端 未结 12 1583
走了就别回头了
走了就别回头了 2020-12-08 03:41

Hopefully this will be a quick fix. I have been trying to figure out the error that i keep getting. The error is listed below and the appdelagate is below that.

An

相关标签:
12条回答
  • 2020-12-08 04:17

    If you're using an NSFetchedResultsController like me and updating data in a background thread, don't forget to begin and end updates in the delegate:

    - (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
        [self.tableView beginUpdates];
    }
    
    - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
        [self.tableView endUpdates];
    }
    
    0 讨论(0)
  • 2020-12-08 04:22

    Simply check that you call [yourTableView reloadData]; after modify array of values.

    0 讨论(0)
  • 2020-12-08 04:24

    I had the same error.

    I was using the following lines

    UINib *myCustomCellNib = [UINib nibWithNibName:@"CustomNib" bundle:nil];
    [tableView registerNib:myCustomCellNib forCellReuseIdentifier:@"CustomNib"];
    

    to register the nib in the viewDidLoad method, since I had a different nib that was also associated with the same class. Hence, the line

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GBFBLoadingCell"];
    

    was returning nil unless I registered the nib in the viewDidLoad.

    My problem was that I forgot to set the identifier in the attributes inspector for my file "CustomNib.xib" and "CustomNib~iphone.xib". (Or more precisely, that I forgot to press enter after typing the identifier in the attribute inspector in XCode, so that the new name failed to save.)

    Hope this helps.

    0 讨论(0)
  • 2020-12-08 04:28

    I put each section elements in separated arrays. Then put them into another array( arrayWithArray). My solution here for this problem:

    [quarantineMessages removeObject : message];
    [_tableView beginUpdates];
    if([[arrayWithArray objectAtIndex: indPath.section] count]  > 1)
    {
        [_tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indPath] withRowAnimation:UITableViewRowAnimationBottom];
    }
    else
    {
        [_tableView deleteSections:[NSIndexSet indexSetWithIndex:indPath.section]
                  withRowAnimation:UITableViewRowAnimationFade];
    }
    [_tableView endUpdates];
    
    0 讨论(0)
  • 2020-12-08 04:28

    I had the same problem with a Core Data base. If your using many FRC, you just need to reload the tableview inside each condition in numberOfSectionsInTableView.

    0 讨论(0)
  • 2020-12-08 04:29

    When removing rows, remember that it also checks sections when updating, in:

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)theTableView
    

    If you want to remove a row that is the last item in a section you need to remove the whole section instead (otherwise it might get section count wrong and throw this exception).

    0 讨论(0)
提交回复
热议问题