in my app in the appDelegate .m i have insert the reachability code like apple say:
-(BOOL)checkInternet
{
Reachability *r = [Reachability reachabilityWithHostName:@"google.com"];
NetworkStatus internetStatus = [r currentReachabilityStatus];
BOOL internet;
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) {
internet = NO;
} else {
internet = YES;
}
return internet;
}
and in my viewcontroller.m in the method – (void)applicationDidBecomeActive:(UIApplication *)application {
gotInternet = [self checkInternet];
if ( gotInternet == 0)
{
//No connection
} else {
//Connection ok
}
but when there are problems on the network 3g my application after about 20 seconds it crashes because of too much latency. How do I implement the control connection asynchronously, never to take the watchdog?
thanks
Have a look at
NSOperationand the concurrency programming guide.