Is Apple's current Reachability class backwards-compatible with iOS 3.1?

↘锁芯ラ 提交于 2019-12-07 23:57:57

问题


I'm implementing Apple's Reachibility class into my application. The app's base SDK is iOS 4.0, and its deployment target is iOS 3.1.

I do not have a 3.1 device to test with, so can anyone tell me if it is backwards compatible? The documents for Reachability say that iOS 4.0 is required, so if it does indeed need a minimum of 4.0, how can I make it work on 3.1?

All I'm doing is testing to see if they are connected to a WiFi network. I'm having to limit streaming video to WiFi only because of Apple's new restrictions (not looking to implement their HTTP Live Streaming at this time).

Here is the code I'm using, so I also would appreciate it if you could make sure that there isn't anything wrong with this. It works fine on iOS 4.0, but I noticed someone saying that it could cause a crash?

Reachability *reachability = [Reachability reachabilityWithHostName:@"www.apple.com"];
NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus];
if (remoteHostStatus != ReachableViaWiFi)
{
  ...
}

回答1:


Never found an answer, but I implemented Andrew Donoho's version of the class and it worked fine on iOS 3.1.2.



来源:https://stackoverflow.com/questions/3624199/is-apples-current-reachability-class-backwards-compatible-with-ios-3-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!