iPhone、NSData、wifi 与蜂窝网络
我正在开发一个应用程序,它使用 NSData 的 initWithContentsOfURL 方法从互联网下载一些数据。在启动时,我使用 Apple 的 Reachability 示例中的一些代码来检查 wifi 连接是否可用;如果没有,那么该应用程序只会显示一条错误消息并拒绝真正启动(按照我的客户的要求)。在 iPod 和 iPad 上一切正常,但在 iPhone 上,我的客户报告下载速度要慢得多,除非他打开飞行模式,在这种情况下,下载速度与 iPod / iPad 速度相当。因此,即使有 wifi 连接可用,iPhone 也可能使用蜂窝网络下载数据。这真的很奇怪。有谁知道我可能做错了什么?
I'm working on an application that downloads some data from the internet using NSData's initWithContentsOfURL method. At startup I'm using some code from Apple's Reachability sample to check if a wifi connection is available; if not, then the app just shows an error message and refuses to really start (as requested by my client). All is working fine on iPod and iPad, but on iPhone, my client reports much, much slower download speeds, unless he turns on airplane mode, in which case download speeds are on par with iPod / iPad speeds. So it seems that even though a wifi connection is available, the iPhone is probably using the cellular network to download the data. Which is really weird. Does anyone have any idea about what I might be doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您的答案是您已经有权访问的 SCNetworkReachability因为您使用的是 Apple 的 Reachability 代码。
如果您需要的话,您还可以使用它来强制执行 WiFi。
看看 UI需要持久WiFi
I believe your answer is SCNetworkReachability which you already have access to since you are using Apple's Reachability code.
You could also use this to enforce WiFi if that's what you want.
Have a look at UIRequiresPersistentWiFi