Possible Duplicate:
Are there more sophisticated alternatives to Apples Reachability class?
Here's an example:
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus internetStatus = [reachability currentReachabilityStatus];
if (internetStatus != NotReachable) {
// Internet is reachable. Start download in background.
} else {
// Create UIAlertView and tell user there is no functional internet!
}
Problem: I've heard that in some cases WiFi "may require a connection for VPN on Demand". So how am I supposed to correctly notify the user about a non-functional internet connection? I assume that the code above is not enough to deal with this.
Here is what I usually do, I didn't try it on VPN though! I create a standalone class for the checking the connection, say it is named
WifiCheckClass
.In the .h file of the class:
In the .m file:
Now using it is very straight forward: