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

来源:互联网 发布:Java医药管理系统 编辑:程序博客网 时间:2024/09/21 06:17

在block里引用self,xcode给出了这个warning:

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

在SO上搜索了一番,好像和我的场景不太一样。最后我解决的办法是:

__block AddShopViewController *weakSelf = self;

然后在block里调用weakSelf:

[weakSelf clearFormAfterAppend];


0 0
原创粉丝点击