Created
November 20, 2012 19:01
-
-
Save romyilano/4120218 to your computer and use it in GitHub Desktop.
Reachability Code
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
// 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