Minor reformatting of weak/strong self pattern for network reachability callbacks
This commit is contained in:
parent
ecac2b3583
commit
652ad787e7
1 changed files with 3 additions and 3 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue