Skip to content

Instantly share code, notes, and snippets.

@romyilano
Created November 20, 2012 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romyilano/4120218 to your computer and use it in GitHub Desktop.
Save romyilano/4120218 to your computer and use it in GitHub Desktop.
Reachability Code
// 1 - nice example from the iPhone for dummies book. Thanks Neal Goldstein! this should be boilerplate reachability
// put in the ApplicationDidFinishLaunchingWithOptions:launchOptions:
// import reachability + make sure that ARC is turned of through -fno-objc-arc
// also import the System configuration framework
// and inside the Reachability class >
// #import <netinet/in.h>
NetworkStatus networkStatus = [[Reachability reachabilityForInternetConnection] currentReachabilityStatus];
if(networkStatus == NotReachable) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Network Unavailable"
message:@"KittyTrip requires an internet connection"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment