Reputation: 5836
I have this very weird case right now with an app I'm working on. The Wi-Fi network I'm testing it on has no internet enabled, yet it still shows that I have a conexión when using Reachability
. How can I check for this case so I can tell the user there is no connection available?
Upvotes: 1
Views: 180
Reputation: 2020
Define 'connection', there are several layers of connections that are key to getting working Internet service via Wi-Fi:
Once all those things are working, you should have 'working Wi-Fi'
Upvotes: 0
Reputation: 2293
You need to use reachabilityWithHostName
(I presume you are using reachabilityForInternetConnection
or reachabilityForLocalWiFi
) to check if you can reach a particular external hostname.
For example, this code will return YES if there is no internet connection:
Reachability *reachability = [Reachability reachabilityWithHostName:@"www.apple.com"];
if ([reachability currentReachabilityStatus] == NotReachable)
return YES;
Upvotes: 1