【发布时间】:2014-02-11 22:11:30
【问题描述】:
正如标题所说:像这样在 AFNetworkingReachability 块中调用函数时,我是否需要对 self 进行弱引用?
__weak myViewController* weakSelf = self;
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status)
{
switch (status) {
case AFNetworkReachabilityStatusReachableViaWiFi:
DLog(@"No Internet Connection");
NSLog([weakSelf reachable] ? @"YES" : @"NO");
weakSelf.aProperty = aPropertyValue.
[weakSelf loadPlaces]; // This function does also contain a block
break;
default:
break;
}
}];
提前谢谢你。
【问题讨论】:
标签: ios iphone objective-c automatic-ref-counting afnetworking