应用程序崩溃在tableview的reloadData方法上

jos*_*osh 7 objective-c uitableview ios

调用[tableView reloadData]表视图的方法后,我的应用程序崩溃了.这是在删除单行tableview(具有表视图默认删除行为)和调用之后发生的[tableView reloadData],然后在此委托numberOfSectionsInTableView应用程序崩溃并向我显示崩溃消息后[UITableViewCell _setDeleteAnimationInProgress : ] : message sent to deallocated instance,我用Google搜索但无法获得健康的响应.如果任何人面临这种​​崩溃,那么请帮助找出这个问题.以下是我的代码.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if(section==0)
        return [[dbSingleton sharedInstance] get_players_count];
    else if(section==1)
        return 0;
}

- (NSString )tableView:(UITableView )tableView titleForHeaderInSection:(NSInteger)section{
    if(section==0)
        return @"Player Detail";
    return nil;
}

- (UITableViewCellEditingStyle)tableView:(UITableView )tableView editingStyleForRowAtIndexPath:(NSIndexPath )indexPath{
    if(indexPath.section==1)
        return UITableViewCellEditingStyleNone;
    else
        return UITableViewCellEditingStyleDelete;
    }
}

-(CGFloat)tableView:(UITableView )tableView heightForRowAtIndexPath:(NSIndexPath )indexPath{
    return 44;
}
Run Code Online (Sandbox Code Playgroud)

寻找回应.提前致谢.

jos*_*osh 12

最后,我找到了解决方案.我在做什么错的是我打电话的方法reloadDatacommitEditingStyle,其平均值在回答删除一行,正如之前提到的数据重新加载这个线程.我希望这也有助于其他人.谢谢你的参与.