I have a function in iOS that I need to disable if the network of user devices is in IPv6. Is there a way by which we can get the IP address of the device (iPhone / iPad) as a string programmatically, and then check if it has an IPv4 or IPv6 network (or simply indicate whether it is on an IPv4 or IPv6 network without receiving actual address)?
The closest I could get to was iPhone / iPad / OSX: how to get my IP address programmatically? (David H.), who again wants us to specify the network only in advance, therefore does not solve my goal ... By his decision, either I always get IPv4 or always IPv6.
For testing on IPv6, I use the Apple64 recommended tool NAT64 ( https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html ).
As a workaround, I use DNS to check ( https://hirooka.pro/?p=6169 ), which I believe is not the correct way, it should be based on the IP address. Also, itβs rather strange, the iPad always shows the IPv4 address (even if it is connected to the IPv6 network), but it changes only in the DNS style ... Does anyone know why this is happening?
Thanks in advance.
ios objective-c xcode dns ipv6
cirronimbo
source share