Reputation: 1541
I am writing an iOS app that used a HTTP web service to get its data. If a user is connected to a WiFi network that requires the user login using some kind of web form (think Starbucks or Wi-Fi at airports) then my app fails with an error 500.
I notice Safari can detect this and launches the authentication page for the user. Is there a standard I can use on to provide this experience, or at least show the user a message asking them to open safari and log in?
Upvotes: 3
Views: 1113
Reputation: 25144
The basic method is: try to download a file somewhere, that you know will never move, and whose contents you already know. Compare the downloaded content with the content that should be downloaded, and you'll know you're on a captive hotspot or not.
Upvotes: 1
Reputation: 15641
You can try with this version of reachability...
It has following intresting methods that can get you started:
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
Upvotes: 1