IOS determines the network environment and ios Network Environment
Https://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html
I downloaded vertion2.2.
When developing Web and other network applications, you must confirm the network environment, connection conditions, and other information. If they are not processed, they will not pass Apple's review.
Reachability
Apple's routine Reachability describes how to obtain/detect the network status.
Use in your program
1. Reachability only copies the Reachability. h and Reachability. m in this routine to your project. 2. Add SystemConfiguration. framework to the project.
Three Network statuses are defined in Reachability.
Typedefenum {
NotReachable = 0, // No connection
ReachableViaWiFi, // use 3G/GPRS network
ReachableViaWWAN // use WiFi
} NetworkStatus;
Simple judgment of Project connection:
// Whether wifi is enabled
+ (BOOL) IsEnableWIFI {
Return ([[Reachability reachabilityForLocalWiFi] currentReachabilityStatus]! = NotReachable );
}
// Whether the network is connected
+ (BOOL) IsEnableConnection {
Return ([[Reachability reachabilityForInternetConnection] currentReachabilityStatus]! = NotReachable );
}
// Whether the network is connected
+ (BOOL) IsEnable3G {
Return ([[Reachability reachabilityForInternetConnection] currentReachabilityStatus] = ReachableViaWWAN );
}