I am using the following code to test whether internet connection is available or not,
NSLog(@"Testing internet connection");
Reachability *internetReach = [Reachability reachabilityWithHostName:@"google.com"];
if([internetReach currentReachabilityStatus] == NotReachable) {
NSLog(@"Internet connection is not Rechable");
} else {
NSLog(@"Internet connection is Rechable");
}
but it is taking too much time to test the internet connection, is there any way to reduce the time ??
Thanks
Unfortunately that code inherently requires accessing the network, which can take unbounded amounts of time (consider extremely slow or unreliable 3G hot spots, for example).
You should probably move that work onto a background queue to avoid blocking your main thread, if at all possible.