Search code examples
ioswifireachabilityinternet-connectionnetwork-connection

iOS devices scenario of wifi but no internet access


I have implemented reachability into my app, however when the user is connected to a public wifi network but there is no internet connection due to the user having to login to the wifi, reachability still returns there is an internet connection.

Is there a way to test for this scenario?


Solution

  • In my opinion, one approach is that create a simple ping to your server or reliable hosts such as google. Your ping also set a short timeout (e.g. 5 seconds). If the ping is not success or timeout, it means your device is not real Internet connection. One more thing is the ping should just be called whenever your reachability says connected.