自iOS 10起,应用程序需要网络权限才能访问网络 如何以编程方式检查我的应用是否设置为“关”或“WLAN”或“WLAN& Celluar数据”?
答案 0 :(得分:0)
您可以使用Reachability进行检查。
Reachability *netReachability = [Reachability reachabilityForInternetConnection];
[netReachability startNotifier];
NetworkStatus networkStatus = [netReachability currentReachabilityStatus];
if(networkStatus == NotReachable)
{
//No internet connection.
}
else if (networkStatus == ReachableViaWiFi)
{
//connected with WiFi network.
}
else if (networkStatus == ReachableViaWWAN)
{
//connected with 3G network.
}
希望这有帮助。