Comments (5)
If you have a look at the connection flags (using the reachabilityFlags method) and check kSCNetworkReachabilityFlagsInterventionRequired is set, that will let you know the app needs to present a login browser.
from reachability.
That's not working either:
Code:
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
NSLog(@"%@", [reach currentReachabilityFlags]);
NSLog(@"%@", [reach currentReachabilityString]);
if ([reach isInterventionRequired]) {
NSLog(@"DNS works, but no internet");
} else {
NSLog(@"Connected to the internet");
}
reach.reachableBlock = ^(Reachability*reach)
{
NSLog(@"REACHABLE!");
};
Output:
2013-05-28 20:11:25.009 test[57961:c07] -R -------
2013-05-28 20:11:25.011 test[57961:c07] WiFi
2013-05-28 20:11:25.012 test[57961:c07] Connected to the internet
2013-05-28 20:11:25.051 test[57961:1903] REACHABLE!
From my mac:
$ ping google.com
PING google.com (173.194.69.139): 56 data bytes
Request timeout for icmp_seq 0
And if I open a browser I get to a webpage where I have to authenticate
from reachability.
I'm also having difficulty with this scenario. It would be really nice to have a simple solution to this situation because working DNS without a working Internet is the same to app users: I need to tell them they have a network problem. A good example is free airport Wifi. Although I have isReachable == True
, I also have isInterventionRequired == NO
, even though I get a login screen in any browser and I'm unable to access any websites.
from reachability.
I can't really do anything about captive portals like this.
The best bet would be to do this at the application level i.e.
- Create a server endpoint that returns a specific response e.g.
OK_APPNAME
- When reachability reports its reachable attempt to contact a server you control over HTTP and check the response.
- if response !=
OK_APPNAME
then its a safe bet to say you have some kind of MITM
from reachability.
It would be cool if reachability would help out with this for example set an endpoint www.example.com/json
and when this json returns something predefined reachability says "internet available".
Or trying to fetch the header from google.com and see if it says google in it or something else, e.g. airport/hotel name of providing internet service.
from reachability.
Related Issues (20)
- Reachability does not detect switching between wifi networks HOT 2
- Always detecting ReachableViaWiFi 'TRUE' in iOS 11 HOT 3
- connection vpn and always callback noreachable
- NSNotification.Name.reachabilityChanged does not work HOT 1
- warning of leak in Xcode
- SIGABRT in TMReachabilityCallback HOT 1
- Why NetworkStatus rawValue dose not match to the Apple's Reachability ?
- iOS12 bug, API cannot callback normal! HOT 1
- Airplane mode with shadowsocks return reachable
- Attempted to dereference garbage pointer HOT 1
- Crash on iOS 12 (Crashed: com.tonymillion.reachability)
- Not work on iOS 13.2.3, iPad Mini 4 HOT 1
- add support to swift package manager
- Symbol not found HOT 2
- Semantic issue cast from pointer to smaller type 'unsigned int' loses information when compile source as Objective-C++
- SCNetworkReachabilityCreateWithAddress Thread 1: EXC_BAD_ACCESS (code=2, address=0x16b04bff0)
- iOS14 always get reachable on 4G with wrong hostname HOT 1
- Uio
- cast to smaller integer type 'unsigned int' from 'Reachability *' [-Wpointer-to-int-cast] NSStringFromClass([self class]), (unsigned int) self, [self currentReachabilityFlags]]; HOT 3
- Privacy manifest required by Apple HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reachability.