Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Determine if Wi-Fi is enabled on iOS with this one weird trick.
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
You can’t perform that action at this time.