Могу ли я использовать только сотовую сеть (3G или край), даже если WiFi подключен к iPhone?

StackOverflow https://stackoverflow.com/questions/5061931

Вопрос

Мне было интересно, могу ли я использовать сотовую сеть (3G или 2G или что у них может быть), даже если Wi-Fi подключен и работает. Я заметил, что Apple имеет «доступность» код пример, но это только скажут мне, если я смогу подключиться с помощью сотовой сети;Вместо этого я хотел бы использовать только сотовую сеть.

С наилучшими пожеланиями, Ноам.

Это было полезно?

Решение

No, I wouldn't imagine so.

My understanding is that if the device is connected to Wifi, 3G is not used for data and all data traffic travels via Wifi.

Only cellular data to another cellular device would use the phone provider's network.

Другие советы

Definitely YES. You should combine Reachability notifications with network interfaces enumeration. And - this point is much important: use BSD socket's bind() call to bind to CONCRETE IP address. Don't use 0.0.0.0 and your app will be network-adaptive and awaring. My poor gist example: https://gist.github.com/avesus/fdb465b60a4f5204845c

I believe that the only way to accomplish this would be to detect if the user is on WiFi (example code is in the "Reachability" example you cited), and if so, prompt them to disable WiFi prior to using your app.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top