ios - Capturing 'self' strongly in this block is likely to lead to a retain cycle
高洛峰
高洛峰 2017-04-17 11:17:15
0
2
474

错误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];
    }];
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
Ty80

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

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

洪涛

在ARC下不用__block 而是用 __weak 为了避免出现循环引用

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!