Created
February 10, 2010 08:29
-
-
Save fguillen/300142 to your computer and use it in GitHub Desktop.
iPhone Reachability minimal version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reachability Objective-C minimal version | |
// I'm new so memory leaks are possible on this code | |
// Extracted from: | |
// http://www.idevapps.com/forum/archive/index.php/t-3329.html | |
// (look for an imported_kelvin's post) | |
// | |
+ (BOOL)networkAvailable{ | |
SCNetworkReachabilityRef netreach; | |
SCNetworkConnectionFlags flags; | |
netreach = SCNetworkReachabilityCreateWithName( kCFAllocatorSystemDefault, "google.com" ); | |
SCNetworkReachabilityGetFlags( netreach, &flags ); | |
BOOL reachable = (kSCNetworkFlagsReachable & flags); | |
return reachable; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment