I have being trying to get my app to determine if there is an internet connection for a couple of days now.
I have the following code:
Code:
-(IBAction)checkforinternetconnection:(id)sender{
Reachability* reachability = [Reachability sharedReachability];
[reachability setHostName:@"www.example.com"]; // set your host name here
NetworkStatus remoteHostStatus = [reachability remoteHostStatus];
if(remoteHostStatus == NotReachable) { }
else if (remoteHostStatus == ReachableViaWiFiNetwork) { }
else if (remoteHostStatus == ReachableViaCarrierDataNetwork) { }
}
and in my view did load:
Code:
internetReachable = [[Reachability reachabilityForInternetConnection] retain];
[internetReachable startNotifier];
hostReachable = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
[hostReachable startNotifier];
I get one error with
Code:
#import "Reachability.h"
I have imported the systemconfiguration framework and have no idea how this is not working!
Thanks in advance for any help!!!!