Add the SystemConfiguration framework
#import "Reachability.h"
-(BOOL)reachable {
NSString *hostName = @"google.com";
Reachability *r = [Reachability reachabilityWithHostName:hostName];
NetworkStatus internetStatus = [r currentReachabilityStatus];
if(internetStatus == NotReachable) {
return NO;
}
return YES;
}
if ([self reachable]) {
NSLog(@"Reachable");
}
else {
NSLog(@"Not Reachable");
}
No comments:
Post a Comment