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

在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];


你可能感兴趣的:(block)