问题
For a university project we're developing a small App which we'd like to get reviewed so we can use it with external testers on the App store.
It got declined however, stating that it couldn't work on ipv6 only networks. The main problem: Our backend server is only accessible via ipv4 (since our university IT doesn't want to allow ipv6 yet) and thus there isn't any ipv6 DNS entry that could be looked up. I understand the concept of the DNS64/NAT64 workflow as explained on https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW1 . However, the main DNS of our university isn't configured to work this way yet..
Is there any way to work around that (using swift)? I think we could be able to somehow detect if the network is ipv6 or ipv4 and then reroute the traffic via a ipv6 tunnel such as sixxs.org?
回答1:
It has nothing to do with your backend server and/or school DNS server. Those being IPv4-only will work fine. It's your app that needs to do the right thing to connect to them.
You don't need to detect whether you are on an IPv6-only network or use any IPv6 tunnels. Higher-level iOS networking APIs already transparently work with DNS64/NAT64 without any changes. If you use low-level socket APIs you just need to call a system API to do a lookup (and you can do this regardless of whether you are on an IPv6-only network or not) before you connect.
来源:https://stackoverflow.com/questions/40213601/ios-support-ipv4-only-api