Доступность режима полета (3G) и Wi-Fi ⇐ IOS
Доступность режима полета (3G) и Wi-Fi
I know the Reachability code will provide if the phone has access to Wifi or 3G network.
However, if the phone has 3G on and Wifi, the Reachability code defaults to saying the phone has Wifi on and I can't detect if 3G network is enabled or not (airplane mode on or off).
I need to find out specifically if 3G mode is on or off when Wifi is also on.
Here is the code:
Reachability *reachability = [Reachability reachabilityForInternetConnection]; [reachability startNotifier]; NetworkStatus status = [reachability currentReachabilityStatus]; NSLog(@"status: %u", status); if(status == NotReachable) //status = 0 { //No internet NSLog(@"nothing is reachable"); } if (status == ReachableViaWiFi) //status = 1 { //WiFi NSLog(@"Wifi is available"); } if (status == ReachableViaWWAN) //status = 2 { //3G NSLog(@"3G is available"); } NSLog(@"%@", s); Basically status is returning 1 even if the 3G is on as well as Wifi.
Is this possible?
Источник: https://stackoverflow.com/questions/130 ... 3g-vs-wifi
I know the Reachability code will provide if the phone has access to Wifi or 3G network.
However, if the phone has 3G on and Wifi, the Reachability code defaults to saying the phone has Wifi on and I can't detect if 3G network is enabled or not (airplane mode on or off).
I need to find out specifically if 3G mode is on or off when Wifi is also on.
Here is the code:
Reachability *reachability = [Reachability reachabilityForInternetConnection]; [reachability startNotifier]; NetworkStatus status = [reachability currentReachabilityStatus]; NSLog(@"status: %u", status); if(status == NotReachable) //status = 0 { //No internet NSLog(@"nothing is reachable"); } if (status == ReachableViaWiFi) //status = 1 { //WiFi NSLog(@"Wifi is available"); } if (status == ReachableViaWWAN) //status = 2 { //3G NSLog(@"3G is available"); } NSLog(@"%@", s); Basically status is returning 1 even if the 3G is on as well as Wifi.
Is this possible?
Источник: https://stackoverflow.com/questions/130 ... 3g-vs-wifi
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение