Quote:
Originally Posted by Peewee
I have a little question about how to check for false positive.
When i e.g have my iphone connected to a wifi hotspot which demands that i need to type in a username and password before i can connect to the internet, I still get the flags that says that i`m connected to wifi.
What I am asking is this, when a phone is connected to a router but the router aint connected to the internet, i need the program to then say that i`m not connected to the internet. How can you archieve that with the use of the reachability code?
|
That's the host part of the reachability class. You can check not only whether the device is connected to a network but also whether a host is reachable. So if you check whatever your end target is that you're trying to connect to then you know the router is online. The remoteHostStatus method is what you're looking for.
By the way be careful where you put these tests. I've had some apps crash from timeouts on launch by having them in the startup code for my app. In the end I moved all of my reachability testing to a thread which sets a flag that I later poll from the main thread. Not only the network device connection test but also the host test can take a really long time and trigger the iPhone OS watchdog to kill your app if it's on the main thread.