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

Why AFNetworkReachabilityManager support IPv6 need to do conditional compile? #3498

Closed
wtlucky opened this issue May 9, 2016 · 17 comments
Closed

Comments

@wtlucky
Copy link

@wtlucky wtlucky commented May 9, 2016

I don't understand why there needs to check the OS_VERSION_MIN_REQUIRED. This mean only the iOS version over 9.0 and OSX version over 10.11 supported IPv6. Is this right? #3174

+ (instancetype)manager
{
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
    struct sockaddr_in6 address;
    bzero(&address, sizeof(address));
    address.sin6_len = sizeof(address);
    address.sin6_family = AF_INET6;
#else
    struct sockaddr_in address;
    bzero(&address, sizeof(address));
    address.sin_len = sizeof(address);
    address.sin_family = AF_INET;
#endif
    return [self managerForAddress:&address];
}
@kcharwood
Copy link
Contributor

@kcharwood kcharwood commented May 10, 2016

Take a look at this issue: Alamofire/Alamofire#1228.

We need to make sure we are consistent in both places.

@taylesworth
Copy link

@taylesworth taylesworth commented May 10, 2016

Except AlamoFire uses a run-time check rather than a compile-time check, right?

@kcharwood
Copy link
Contributor

@kcharwood kcharwood commented May 10, 2016

Yes, that rights, mainly due to some bugs with how iOS 8 works with IPv6

@wtlucky
Copy link
Author

@wtlucky wtlucky commented May 10, 2016

Yes,I have found this bug both iOS 7 and iOS 8 works with IPv6. But why not use run-time check there? If I use the iOS 9 SDK compile the project and running it on iOS 7, the bug still exist.

@kcharwood
Copy link
Contributor

@kcharwood kcharwood commented May 10, 2016

Right. I'm agreeing with you. We should probably migrate to a runtime check.

@hei9gag
Copy link

@hei9gag hei9gag commented May 11, 2016

I am using iOS 9 and connect to a NAT64 network hotspot share from my Mac. I try to test the AFNetworking Reachability without ipv6 setting and it still works. Can someone explain? Many thanks.

@cezheng
Copy link

@cezheng cezheng commented May 16, 2016

However in the README of the Reachability sample, it says

Reachability fully supports IPv6. More specifically, each of the APIs handles IPv6 in the following way:

...

reachabilityForInternetConnection: This monitors the address 0.0.0.0, which reachability treats as a special token that causes it to actually monitor the general routing status of the device, both IPv4 and IPv6.


So what is the actual reason to use sockaddr_in6 on iOS 9 or later? I just worry that it will cause problems when connected to a IPv4-only network

@hei9gag
Copy link

@hei9gag hei9gag commented May 18, 2016

It seems the Reachability function is not compatible to iOS 7. The function returns no reachable status even I have connected to a NAT64 share network. Is this a bug or iOS 7 isn't support NAT64?

Also I found that reachabilityDidChange is slightly delay to trigger in iOS 8 (compare to iOS 9) when I try to connect to a IPv6 network from no network status.

@dustturtle
Copy link

@dustturtle dustturtle commented May 19, 2016

I agree with cezheng. Demo by apple maybe right. I will just use the sockaddr_in in my app. @cezheng

@Taaaaaaang
Copy link

@Taaaaaaang Taaaaaaang commented May 20, 2016

There is no need to change anything if you just want to check whether the internet is avaliable,just like the Sample by Apple:
reachabilityForInternetConnection //This monitors the address 0.0.0.0, which reachability treats as a special token that causes it to actually monitor the general routing status of the device, both IPv4 and IPv6 is it right?

@cezheng
Copy link

@cezheng cezheng commented May 22, 2016

@kcharwood Shall we draw to a conclusion yet? I think we should remove the sockaddr_in6 part of the code.

@dustturtle
Copy link

@dustturtle dustturtle commented May 23, 2016

But I think the solution used here is also correct. We can use ipv4/ipv6 either under iOS9 in this condition.

@AdrianaPineda
Copy link

@AdrianaPineda AdrianaPineda commented Jun 20, 2016

@kcharwood do you have any updates on this? Should the os version check be removed as Alamofire?

@xx-li
Copy link

@xx-li xx-li commented Dec 16, 2016

My app minimum supported version of the app is iOS9, use AFNetworking by cocoapods, when run at any device, __IPHONE_OS_VERSION_MIN_REQUIRED is the the pod targert minimum version, value is 70000, Causing works with IPv4 all the time。

@shumintao
Copy link

@shumintao shumintao commented May 24, 2017

can you tell me how to use AlamoFire for swift in IVP6

@stale
Copy link

@stale stale bot commented Mar 31, 2020

This issue has been marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Mar 31, 2020
@stale
Copy link

@stale stale bot commented Apr 7, 2020

This issue has been auto-closed because there hasn't been any activity for at least 21 days. However, we really appreciate your contribution, so thank you for that! 🙏 Also, feel free to open a new issue if you still experience this problem 👍.

@stale stale bot closed this Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants