IOS异常:Capturing 'self' strongly in this block is l

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


你可能感兴趣的:(IOS异常:Capturing 'self' strongly in this block is l)