Created
May 21, 2014 18:35
-
-
Save enigmaticape/335800709e3a9ca69b10 to your computer and use it in GitHub Desktop.
Determine if Wi-Fi is enabled on iOS with this one weird trick.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ifaddrs *interfaces; | |
if(!getifaddrs(&interfaces)) { | |
for( struct ifaddrs *interface = interfaces; interface; interface=interface->ifa_next) { | |
BOOL up = (interface->ifa_flags & IFF_UP) == IFF_UP; | |
if ( up ) { | |
NSLog( | |
@"Name : %s, sa_family : %d", | |
interface->ifa_name, | |
interface->ifa_addr->sa_family | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment