0

How can I detect Internet (not WiFi) connectivity on iOS? The reachability .h and .m files detect WiFi connectivity, but what about the scenarios where WiFi is on, but the modem's cable is unplugged? In those cases, WiFi is enabled, but there's no Internet connectivity.

4

1 回答 1

1

您可以使用 Apple 可达性,我在 gitHub 中有一个小项目,它是可达性使用的示例,在我的项目中MMReachabilityViewController它是一个通用示例,但您可以更改它,Apple lib 让您以 3 种不同的方式检查连接:

reachabilityForInternetConnection // generic

reachabilityForLocalWiFi // local wifi

reachabilityWithHostName // for apllication based on a specific host
于 2013-06-15T08:44:08.280 回答