Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround for reachability when already online #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sega-Zero
Copy link

No description provided.

@Sega-Zero
Copy link
Author

more info on #65 (sorry, couldn't find how to set pull request there)

@tonymillion
Copy link
Owner

The problem here is that 0 flags can indicate no connectivity.

As I've said before you shouldn't use Reachability to determine if you should make a network request, you should always try the request and if it fails queue it up to be executed once Reachability indicates network is reachable.

@Sega-Zero
Copy link
Author

The bad thing is that this flag==0 happens right in the case you've described. and when the internet becomes online, only flag==0 is received. no kSCNetworkReachabilityFlagsReachable at all. and this happens both 10.9 and 10.10 but not all machines

@Sega-Zero
Copy link
Author

I found the reason of this behavior: the problem was that i was creating Reachability with full url, not the host. in this case reachability always sends 0 in flags

I think the constructor should be aware of that and extract correct host value

@tettoffensive
Copy link

@Sega-Zero I was wondering why reachability was always backwards when i started up my app for Reachability with @"http://myurlhere.com/" I would first get reachable, then unreachable next (even though it was always reachable. Your last comment here fixed this issue!

[NSURL URLWithString:@"http://myurlhere.com/"].host was the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants