ios block Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)

问题描述

Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)

相关代码

// 请把代码文本粘贴到下方(请勿用图片代替代码)

  • (UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

MainTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"set" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;

DSLBuShouItem * item = self.dataArray[indexPath.section];
cell.item = item;
__weak MainTableView* weakSelf = self;
cell.restBlock = ^(NSString *detailStr) {
    NSLog(@"ddff8888");
    __strong MainTableView* strongSelf = weakSelf;
    //if (strongSelf.topInsetBlock) {
        strongSelf.topInsetBlock();//把if语句注释出现Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)不注释的话strongSelf.topInsetBlock();不执行。我也很郁闷
    //}
};

return cell;

}

阅读 5.7k
1 个回答

说明 topInsetBlock()这个block有问题啊,值为nil,而且只贴了这么一段代码,其他相关的代码都没有贴出来,不好判断具体问题出在哪啊,但应该就是topInsetBlock 定义有问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题