IOS异常:Capturing 'self' strongly in this block is l
IOS异常:Capturing 'self' strongly in this block is l
满月不满 发表于3年前
IOS异常:Capturing 'self' strongly in this block is l
  • 发表于 3年前
  • 阅读 17
  • 收藏 0
  • 点赞 0
  • 评论 0

移动开发云端新模式探索实践 >>>   

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

May

10

2014

        _player.completionBlock = ^{
            [self stopPlay];
        };



上面在block里用self是会有提示:
Capturing 'self' strongly in this block is likely to lead to a retain cycle

可以这样改一下

        __weak typeof(self) weakSelf = self;
        _player.completionBlock = ^{
            [weakSelf stopPlay];
        };



参考自:http://stackoverflow.com/questions/14556605/capturing-self-strongly-in-this-block-is-likely-to-lead-to-a-retain-cycle


  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 0
博文 7
码字总数 781
×
满月不满
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: