Доступность режима полета (3G) и Wi-FiIOS

Программируем под IOS
Ответить
Anonymous
 Доступность режима полета (3G) и Wi-Fi

Сообщение Anonymous »


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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»