i'm using the AFN to check the network.
__block BOOL connect;
AFNetworkReachabilityManager*manager = [AFNetworkReachabilityManager sharedManager];
[manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
switch (status) {
case -1:
connect=YES;
break;
case 0:
connect=NO;
break;
case 1:
connect=YES;
break;
case 2:
connect=YES;
break;
default:
break;
}
}];
[manager startMonitoring];
and i want to get the Bool connect at another file
if (![ValueUtils isConnectNet])
but it didn't get the bool immediately how can i get the bool first and then do the “if else” thing?
now i use Reachability ,if u use AFN's isReachable right after startMonitoring,it can't get the current network status immediately.