I have quite a few problems with accurately determining the type of network access the iPhone has. I saw a lot of questions like this on StackOverflow, but none of them helped me. For example, I have already seen this: How to check the active Internet connection on iOS or OSX?
But I want to know exactly when the following three cases occur:
Wi-Fi and 3G disabled
Wi-Fi or 3G is available, but there is no internet connection. This may be due to the fact that 3G does not work, even if it is displayed in the status bar, or Wi-Fi is a hot spot asking for a login before allowing access to the Internet or the last scenario: the WiFi source is a local network but do not provide any internet connection.
Everything works perfectly
Of course, I tried different things, for example, for example:
But this, apparently, simply means that Wi-Fi or 3G is turned on and does not check for possible Internet restrictions. I would be very pleased with any answer that helps me identify three scenarios.
Of course, analyzing a direct HTTP request request from a personal API server returning a specific sequence of bytes will work, but this is not what I would like to do. I would prefer to use any API to increase accessibility.
I used Apple's reachability API, it doesn't seem to recognize hotspot redirects.
If this is not possible with the Reachability APIs, then what will be the lowest resource-intensive method for a simple server request, make sure it is reached before the specified timeout and that the URL is not redirected to the hot spot login page (maybe check only the headers , but not the entire output of the server byte sequence)? Is it a good idea to run such a script every 15 seconds or use too much battery and / or network data?
source share