The era of the Internet, all have a network of the times, there is no network, nothing can do, just as the development of an app, care about users, detection and network, all need to make judgments, the most commonly used is the following
Reachability
Supports Arc and GCD
Define a method that can be interpreted by the return value, or directly in the method.
Here's one of the methods
-(void) Networkstatechange
{
//1. Detection WiFi Status
reachability *wifi = [reachability Reachabilityforlocalwifi];
//2. detect if the phone can be on the network (wifi\3g\2.5g)
reachability *conn = [reachability reachabilityforinternetconnection];
//3. Determine network status
if ([WiFi currentreachabilitystatus]! = Notreachable | | [Conn Currentreachabilitystatus]! = notreachable) {// have wifi
}else { // No network
}
}
This article is from the "snowflakes flying over the World" blog, please be sure to keep this source http://smengxiang.blog.51cto.com/11204872/1859526
Current network status of IOS interpretation files