简体   繁体   English

如何使用iPhone SDK以编程方式更改从3G到Wi-Fi的连接?

[英]How to change connection from 3G to wi-fi programmatically using iPhone SDK?

Lets consider that I am connected to internet through 3G in my App. 让我们考虑一下,我在我的应用程序中通过3G连接到互联网。 When a wi-fi hot spot seems to be appearing, can I programmatically switch to the wi-fi. 当一个Wi-Fi热点似乎出现时,我可以通过编程方式切换到Wi-Fi。 Is this vice-versa condition possible? 反之亦然吗?

iOS does this automatically by itself! iOS会自动执行此操作!

If no known WiFi network is found, it uses cellular data. 如果未找到已知的WiFi网络,则它使用蜂窝数据。 If it finds a known WiFi-network, it connects to and uses that network instead. 如果它找到已知的WiFi网络,它将连接并使用该网络。

If any WiFi-network is found, and your application requests access to the internet, iOS (usually) automatically presents an alertView and lets the user log in to a WiFi-network. 如果找到任何WiFi网络,并且您的应用程序请求访问互联网,iOS(通常)会自动显示alertView并让用户登录到WiFi网络。 If the user does not log into a WiFi-network, it stays on the 3G-network. 如果用户未登录WiFi网络,则它将保留在3G网络上。 When iOS 7 comes, iOS may connect to Hotspot 2.0 networks automatically as well. 当iOS 7出现时,iOS也可以自动连接到Hotspot 2.0网络。

Apple keeps individual apps on a tight leash, and so they do not let apps control things like this. Apple会严格限制个人应用程序,因此他们不会让应用程序控制这样的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM