Skip to content

Instantly share code, notes, and snippets.

@fguillen
Created February 10, 2010 08:29
Show Gist options
  • Save fguillen/300142 to your computer and use it in GitHub Desktop.
Save fguillen/300142 to your computer and use it in GitHub Desktop.
iPhone Reachability minimal version
// 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