Unable to detect Wi-Fi enabled or disabled only on iPad 2

I use the code snippet below to determine if Wi-Fi is on or not. This code works great on iPad Air or

(BOOL) isWiFiEnabled {

    NSCountedSet * cset = [NSCountedSet new];

    struct ifaddrs *interfaces;

    if( ! getifaddrs(&interfaces) ) {
        for( struct ifaddrs *interface = interfaces; interface; interface = interface->ifa_next) {
            if ( (interface->ifa_flags & IFF_UP) == IFF_UP ) {
                [cset addObject:[NSString stringWithUTF8String:interface->ifa_name]];
            }
        }
    }

    return [cset countForObject:@"awdl0"] > 1 ? YES : NO;
}

For the iPad 2 model, this code does not work, that is, it returns 0. Please help me with this, for example, any other way to detect Wi-Fi on this model.

This issue is specific to iPad 2 only, and I already mentioned that it works great for iPad Air and other models.

+4
source share
1 answer

, " en1" " awdl0" iPad Reachability. , "en1" "awdl0".

AFAIK " awdl0" iPhone 4/4s, iPad 2.

0

Source: https://habr.com/ru/post/1629219/


All Articles