I'm using the Reachability
class provided by Apple and I'm listening for the reachabilityChanged:
notification:
- (void)reachabilityChanged:(NSNotification *)notification
{
Reachability *reach = [notification object];
if ([reach isKindOfClass: [Reachability class]]) {
NetworkStatus status = [reach currentReachabilityStatus];
if ((status == ReachableViaWiFi) || (status == ReachableViaWWAN)) {
// Some operations here
}
}
}
When I set flight mode or disable WiFi and cellular data in settings, I get a "NotReachable" status in reachabilityChanged:
, but when my device seems to just lose the connectivity temporarily for whatever reason (having communications enabled in settings), the "NotReachable" status seems to not being detected.
I've done some tests with a jammer, and when the device goes to "No Service" in the status bar and reachabilityChanged:
is called, I've seen that the NetworkStatus
is "ReachableViaWWAN" instead of "NotReachable" as I expected.
I need to detect such "No Service" status in the device, how could I?