Home  >  Q&A  >  body text

objective-c - iOS设备怎么知道当前网络是IPV4的还是IPV6的

如题,目前我的设备访问的服务器是通过IP加端口来的,
这次苹果审核苹果要求支持IPV6的网络,
在设备里该怎么判断呢,是需要服务器做设置吗?

为情所困为情所困2697 days ago1281

reply all(2)I'll reply

  • 为情所困

    为情所困2017-05-02 09:31:30

    Apple is saying that it must support IPv6-only networks, that is, your app can be used normally even if there is only an IPv6 network.
    If the IP address you resolve is in IPv4 format `x.x.x.x`, it will not be accessible under an IPv6-only network.

    Share the network on a Mac computer with a network cable, select "NAT64", and then connect to your shared network on the iPhone to establish an IPv6-only network. You can see whether the DNS has changed to IPv6 format in the "Wireless LAN" of the mobile phone settings. You can also test it by visiting http://ipv6-test.com.

    After simulating the network environment, run your app to see if the resolved IP is an IPv6 address and whether it can be accessed normally.

    Unless there are special needs, it is best not to use IP directly, use domain name.

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-02 09:31:30

    Just map a domain name and it will be solved. If you write a fixed IPv4 address directly, it will definitely not support IPv6.
    There are many ways to check, and Apple all conducts manual review. It should not be difficult to monitor the network communication mechanism of the APP.
    But I don’t know exactly how the official does it.

    reply
    0
  • Cancelreply