Iphone internet connection (Reachability)
Posted
by ludo
on Stack Overflow
See other posts from Stack Overflow
or by ludo
Published on 2010-04-19T07:46:45Z
Indexed on
2010/04/19
8:03 UTC
Read the original article
Hit count: 347
Hi,
I saw any post about Reachability but people doesn't really give the exact answer to the problem. In my application I use the Reachability code from apple and in my appDelegate I use this:
-(BOOL)checkInternet {
Reachability *reachability = [Reachability reachabilityWithHostName:@"www.google.com"];
NetworkStatus internetStatus = [reachability currentReachabilityStatus];
BOOL internet;
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) {
internet = NO;
}else {
internet = YES;
}
return internet;
}
So the problem is even if I have an internet connection, this code telling me that I don't have one. Does anyone know what to do to make this working?
Thanks,
© Stack Overflow or respective owner