Capturing 'self' strongly in this block is likely to lead to a retain cycle

错误ID

ListViewController.m:135:10: Capturing 'self' strongly in this block is likely to lead to a retain cycle

开了ARC

    [_tableView setPullToRefreshHandler:^{
        [self dataDidRefresh:nil];
    }];

回答


你把self转换一下加上block字段之后就不会被retain了

__block ViewController *controller = self;
[_tableView setPullToRefreshHandler:^{
[controller dataDidRefresh:nil];
}];



参考:http://segmentfault.com/q/1010000000153942

你可能感兴趣的:(Capturing 'self' strongly in this block is likely to lead to a retain cycle)