Minor reformatting of weak/strong self pattern for network reachability callbacks

This commit is contained in:
Mattt Thompson 2012-10-31 07:42:19 -07:00
parent ecac2b3583
commit 652ad787e7

View file

@ -336,13 +336,13 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {}
self.networkReachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [[self.baseURL host] UTF8String]); self.networkReachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [[self.baseURL host] UTF8String]);
__weak AFHTTPClient *weakSelf = self; __weak __typeof(&*self)weakSelf = self;
AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status){ AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status){
__strong AFHTTPClient *strongSelf = weakSelf; __strong __typeof(&*weakSelf)strongSelf = weakSelf;
if (!strongSelf) { if (!strongSelf) {
// the weak ref is gone, depart this block
return; return;
} }
strongSelf.networkReachabilityStatus = status; strongSelf.networkReachabilityStatus = status;
if (strongSelf.networkReachabilityStatusBlock) { if (strongSelf.networkReachabilityStatusBlock) {
strongSelf.networkReachabilityStatusBlock(status); strongSelf.networkReachabilityStatusBlock(status);