简体   繁体   English

什么时候*必须*应用程序包含Reachability类来测试网络可达性?

[英]When exactly *must* an app include the Reachability class to test for network reachability?

According to Cocoa with Love Reachability is needed when an app requires WiFi (rather than cellular network), eg if app loads heavy videos and is not meant to be used over 3G. 根据Cocoa with Love ,当应用程序需要WiFi(而不是蜂窝网络)时需要可达性,例如,如果应用程序加载重量级视频并且不打算通过3G使用。

My app uses internet no matter if WiFi or 3G and only downloads small data from web services. 我的应用程序使用互联网,无论是WiFi还是3G,只从Web服务下载小数据。

Can someone clarify under which circumstances an app must do this reachability test? 有人可以澄清应用程序必须在哪种情况下进行此可达性测试?

Since you're using internet connection only for small data downloads you really don't need to care if you're using WiFi or 3G. 由于您仅使用互联网连接进行小型数据下载,因此如果您使用的是WiFi或3G,则无需关心。

True, there are some restrictions for cellular newtorks. 的确,蜂窝网络有一些限制。 Take a look at paragraphs 9.3 and 9.4 AppStore Review Guidelines . 参阅第9.3和9.4段AppStore Review Guidelines You need a developer id to view it so i think we're not allowed to quote it here. 您需要一个开发者ID来查看它,所以我认为我们不允许在这里引用它。

Reachability is needed if your application needs to know 'when' it's ability to access the network has changed. 如果您的应用程序需要知道“何时”访问网络的能力发生了变化,则需要可达性。

I've seen recommendations that say to always try to access your resource first, and if you fail - to use data from Reachability to find out why. 我见过的建议总是先尝试访问你的资源,如果你失败了 - 使用Reachability的数据来找出原因。

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

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