objective c - How to check if WIFI button is enabled (iOS) -


i want able check see if user connected wifi, not connected network. want check state of wifi button on device setting page check if button enabled or disabled.

at moment can check see if wifi connected network or not connected network doing following:

bool haswifinetwork = no; nsarray *interfaces = cfbridgingrelease(cncopysupportedinterfaces()); (nsstring *interface in interfaces) {     nsdictionary *networkinfo = cfbridgingrelease(cncopycurrentnetworkinfo((__bridge cfstringref)(interface)));     if (networkinfo != null)     {         haswifinetwork = yes;         break;     }     else     {         haswifinetwork = no;         break;     } } 

update

it turns out isn't possible, there no api/framework/bool value can because apple havn't added kind of ability check see if wifi switched on or off developers. explained nicely here: https://stackoverflow.com/a/12906461/4657588


then post should want: https://stackoverflow.com/a/7938778/4657588

reachability *reachability = [reachability reachabilityforinternetconnection]; [reachability startnotifier];  networkstatus status = [reachability currentreachabilitystatus];  if (status == reachableviawifi) {     // wifi }  else {     // either wifi off or not connected wifi network. } 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -