鍍金池/ 問答/iOS/ ios block Thread 1: EXC_BAD_ACCESS (cod

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語句注釋出現(xiàn)Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)不注釋的話strongSelf.topInsetBlock();不執(zhí)行。我也很郁悶
    //}
};

return cell;

}

回答
編輯回答
使勁操

說明 topInsetBlock()這個block有問題啊,值為nil,而且只貼了這么一段代碼,其他相關的代碼都沒有貼出來,不好判斷具體問題出在哪啊,但應該就是topInsetBlock 定義有問題

2017年9月29日 14:26