I ran into a strange problem on iPhone 5 with iOS 7, I had the same code with other devices like iPad1, 2, 3 and iPhone 4, 4, etc. with another combination of iOS, including iOS 7.
Problem:
When I turn on airplane mode, I receive a notification of achievement, as expected, with a status NotReachable, but immediately after this application receives a notification with a status ReachableViaWWANthat is not expected.
Code:
+(BOOL)checkReachability
{
Reachability* internetReachable = [Reachability reachabilityForInternetConnection];
NetworkStatus internetStatus = [internetReachable currentReachabilityStatus];
switch (internetStatus)
{
case NotReachable:
{
DebugLog(@"The internet is down.");
return NO;
break;
}
default:
return YES;
break;
}
return YES;
}
I added a log before switching, which returns the status ReachableViaWWANin flight mode.
A possible workaround might be:
Add case for ReachableViaWWANand check host availability in this case. And return the BOOL value accordingly.
- ? , .
!