SCNetworkReachabilityFlags flags; BOOL receivedFlags; SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(CFAllocatorGetDefault(), [@"google.com" UTF8String]); receivedFlags = SCNetworkReachabilityGetFlags(reachability, &flags); CFRelease(reachability); //NSLog(@"idiotic flags %@", receivedFlags); if (!receivedFlags || (flags == 0)) { return NO; } else { return YES; }
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/5246.html