【发布时间】:2015-02-21 21:11:39
【问题描述】:
如果块内的代码调用了一个方法,如果该方法引用了self,是否会存在retain循环?换句话说,一个block下游的所有代码都需要使用weakSelf/strongSelf模式吗?
例如:
__weak __typeof__(self) weakSelf = self;
Myblock block = ^{
[weakSelf doSomething];
};
。 . .
- (void)doSomething
{
self.myProperty = 5; // Is this ok or does it need to use a weakSelf?
}
【问题讨论】:
标签: objective-c objective-c-blocks retain-cycle