-
-
Save AlexHedley/2f257ee45d78b83631cc to your computer and use it in GitHub Desktop.
Reachability
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
//http://iosameer.blogspot.co.uk/2013/01/checking-internet-connection-in-ios-apps.html | |
#import "Reachability.h" | |
//// Just use it ,Where you need it (checking internet connection) | |
Reachability *reachTest = [Reachability reachabilityWithHostName:@"www.apple.com"]; | |
NetworkStatus internetStatus = [reachTest currentReachabilityStatus]; | |
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) { | |
/// Create an alert if connection doesn't work,no internet connection | |
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" | |
message:@"You require an internet connection via WiFi or cellular network for location finding to work." | |
delegate:self | |
cancelButtonTitle:@"Ok" | |
otherButtonTitles:nil]; | |
[myAlert show]; | |
[myAlert release]; | |
} | |
else { | |
// There is a internet connection | |
/// Do,Whatever you want | |
} | |
//https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html | |
//https://github.com/tonymillion/Reachability | |
//http://code.tutsplus.com/tutorials/ios-sdk-detecting-network-changes-with-reachability--mobile-18299 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment