即使 iPhone 上已连接 WIFI,我也可以仅使用蜂窝网络(3G 或 EDGE)吗?
我想知道即使 WIFI 已连接并工作,我是否可以使用蜂窝网络(3G 或 2G 或任何其他网络)。 我注意到苹果有一个“可达性”示例代码,但这只会告诉我是否可以使用蜂窝网络进行连接;相反,我想实际上只使用蜂窝网络。
此致, 诺姆。
I was wondering whether I can use the cellular network (3G or 2G or whatever they may have) even if the WIFI is connected and working.
I noticed that Apple has a "Reachability" sample code, but that would only tell me if I can connect using a cellular network; instead, I would like to actually use ONLY the cellular network.
Best Regards,
Noam.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
绝对是的。您应该将可达性通知与网络接口枚举结合起来。并且-这一点非常重要:使用BSD套接字的bind()调用来绑定到具体的IP地址。不要使用 0.0.0.0,您的应用程序将具有网络适应性和感知能力。我可怜的要点示例: https://gist.github.com/avesus/fdb465b60a4f5204845c
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
不,我不会这么想。
我的理解是,如果设备连接到Wifi,则3G不用于数据,所有数据流量都通过Wifi传输。
只有到另一个蜂窝设备的蜂窝数据才会使用电话提供商的网络。
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.
我相信实现这一点的唯一方法是检测用户是否使用 WiFi(示例代码位于您引用的“可达性”示例中),如果是,则提示他们在使用您的应用程序之前禁用 WiFi。
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.