首页 > 其他 > 详细

invalid update:invalid number of rows in selection 0.The number of rows contained in an existing section after the update(38) must be equal to the number of rows contained in that selection.....

时间:2019-07-24 18:05:18      阅读:108      评论:0      收藏:0      [点我收藏+]

技术分享图片

 

当程序报这个错的时候:一般情况下是由于快速滑动过程中点击表中某一行,而且同时执行了此行的内容变化及其他方法同时执行造成。例如:字体变化、图片变化等引起的冲突,从而形成的程序崩溃。

这里是由于在快速滑动过程中,点击了某一行。造成,表格还在滑动过程中,点击的一行执行字体变化,同时执行下载操作等一系列复杂操作。

解决方法:想刷新表格同时执行其他操作。那就全局刷新表格吧

用[weakSelf.tableView reloadData]代替单单对某一行的刷新。
当然还有其他方法。也可以试试
例如:重新获取数据加载表格等等。
-(void)updateMessageStatusToAlreadyRead:(CommenModel *)model
{
    NSString *url =[NSString stringWithFormat:@"%@/%@/*************",BASEURL,PLATFORM];
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    NSDictionary *dic = @{@"id":model.ID.length?model.ID:@"",@"pid":model.pid.length?model.pid:@"",@"infoId":model.info_id.length?model.info_id:@"",@"type":@"oa_notice",@"pnid":model.pnid.length?model.pnid:@"",@"userId":userID};
    NSData * data = [NSJSONSerialization dataWithJSONObject:dic options:kNilOptions error:nil];
    NSString *dataStr = [[NSString alloc] initWithData:data
                                              encoding:NSUTF8StringEncoding];
    [parameters setValue:dataStr forKey:@"__DATA"];
       __weak typeof(self)weakSelf = self;
    [NetRequestHelp createNetRequestWithURL:url parameters:parameters requestType:CYRequestMethodTypePOST responseSeializerType:CYResponseSeializerTypeJSON completionHandle:^(BOOL success, id responseObject, NSString *message) {
        if(success)
            {
#ifdef  MESSAGENOTICE_OPEN_WITH_NO_REFRESH
                if ([self.dataArray indexOfObject:model] != NSNotFound) {
                    NSInteger inde =[self.dataArray indexOfObject:model] ;
                    model.status = @"1";
                    [weakSelf.dataArray replaceObjectAtIndex:inde withObject:model];
                    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:inde inSection:0];
//                    [weakSelf.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
                    [weakSelf.tableView reloadData];//全局重新加载
                }
#else
                [weakSelf refreshTable];
#endif
            }
        else
            {
            
            }
    }];
}

 

invalid update:invalid number of rows in selection 0.The number of rows contained in an existing section after the update(38) must be equal to the number of rows contained in that selection.....

原文:https://www.cnblogs.com/OIMM/p/11239393.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!