I know there are other threads on this, but I just can't get this working. I need to check to see if a device has an internet connection, so I am using the Reachability code from the Apple sample.
I imported Reachability.h and .m into my project and now I am trying to execute the following code:
It compiles fine, but I get a run time error when I attempt to execute the first line. Here is the error:
Can someone PLEASE help me!!
I imported Reachability.h and .m into my project and now I am trying to execute the following code:
Code:
Reachability *r = [[Reachability reachabilityForInternetConnection] retain];
NetworkStatus internetStatus = [r currentReachabilityStatus];
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))
{
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];
}
It compiles fine, but I get a run time error when I attempt to execute the first line. Here is the error:
2010-02-09 23:10:03.594 MyiPhoneApp[3170:207] *** +[Reachability reachabilityForInternetConnection]: unrecognized selector sent to class 0x1b650
2010-02-09 23:10:03.605 MyiPhoneApp[3170:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[Reachability reachabilityForInternetConnection]: unrecognized selector sent to class 0x1b650'
2010-02-09 23:10:03.613 MyiPhoneApp[3170:207] Stack: (
864992541,
859229716,
864996485,
864492313,
864454720,
17989,
26151,
864749711,
839231364,
839231212,
839231156,
839230220,
839233420,
839227648,
839225236,
839206800,
839205012,
875886564,
864740651,
864738335,
875880904,
838872112,
838865456,
11877,
11740
)
terminate called after throwing an instance of 'NSException'
Program received signal: SIGABRT.
(gdb)
Can someone PLEASE help me!!