iOS开发 循环引用的几种场景

2018-06-28  本文已影响30人  naruto_yuqin
__weak typeof(self) weakSelf = self;
[self doSomeBlockJob:^{
    __strong typeof(weakSelf) strongSelf = weakSelf;
    if (strongSelf) {
        ...
    }
}];
    [_timer invalidate];
    _timer = nil;

@interface SomeObj : NSObject
@property (nonatomic, strong)   NSMutableArray *array;
@end

[_array addObject:self];

或许还有其他场景,欢迎建议、点评、指正、增加。谢谢!

上一篇 下一篇

猜你喜欢

热点阅读