14

As Apple is requesting app submitted for review must support IPv6-only network starting from 1st June 2016, I am checking if I need to replace certain API / libraries in my app. However I don't know much enough about networking and some related aspects, as a result I am unable to have a definite answer on this and would like to seek for help.

Regarding the document Supporting IPv6 DNS64/NAT64 Networks provided by Apple, it states that apps should be fine and no need to perform update if:

you’re writing a client-side app using high-level networking APIs such as NSURLSession and the CFNetwork frameworks and you connect by name

By this I take it as 2 criteria:

  1. using NSURLSession or CFNetwork
  2. connect by name

So the question here is:

  1. As far as I know NSURLConnection is based on CFNetwork, does this mean I will be fine too if my app is using NSURLConnection? (I saw NSURLConnection is also mentioned in this image in the above document, but again I am not quite sure about this as NSURLConnection is kind of old? And seems I cannot find documents mentioning IPv4 and IPv6 support either.)

  2. By the criteria "calling by name", does this mean no matter I am using NSURLSession or NSURLConnection, if I happen to call or access certain resources / APIs by an IPv4 address, bad things will happen? (I've done some research, and from my understanding clients like iOS device with iOS 9+ will always use synthesized IPv6 address to access IPv4 server, as a result the client will fail to reach the resource if I call by IPv4 address?)

Thanks for any help!

peakingcube
  • 1,388
  • 15
  • 32
  • hi alando ,Is i need to convert my server from ipV4 to ipV6 ? http://stackoverflow.com/questions/38046187/how-to-fix-please-ensure-that-your-app-supports-ipv6-networks-as-ipv6-compatibi/38046471#38046471 – 9to5ios Jun 27 '16 at 05:58
  • hi @iphonemaclover, that issue should be about your app's ability to access IPv6 only resource if I didn't get it wrong. It has nothing to do with your server, but if any resources you app access is IPv6 only and your app is unable to access them, you will need to handle it. – peakingcube Jun 29 '16 at 03:31
  • please check my question in above comment, i am still confused, that using NSURLConnection in SOAP method my app rejected by apple. Is i need to transfer my API in server from ipV4 to ipV6 ? – 9to5ios Jun 29 '16 at 06:58

3 Answers3

6
  1. It will probably be fine. But you can just test it yourself by connecting to a NAT64 network created by your Mac and see if your app works.
  2. Both names and IPv4 literals will work if you use the higher-level APIs in iOS 9.2+.
user102008
  • 30,736
  • 10
  • 83
  • 104
  • Thanks for your answer. One more minor question is that I've just realized if I try to access IPv6-only resources with IPv4 literals, it must result in failure, isn't it? So my concern in point 2 is kind of meaningless, as if I am using IPv4 literals, I will be accessing IPv4 compatible resources, otherwise I should call by name and let DNS handle the IP stuffs. Is this correct? – peakingcube May 09 '16 at 05:01
  • @alanlo: Not sure what you mean. If you got an IPv4 literal, then by definition it's for an IPv4-compatible server. An IPv6-only server obviously wouldn't be known by any IPv4 literals. – user102008 May 09 '16 at 09:11
  • Yeah you got exactly what I mean, that solved my problem as I interpreted the opposite case of "call by name" wrongly, thanks! – peakingcube May 10 '16 at 02:48
3

NSURLConnection is in the recommended list, check Figure 10-5 inside Apples dns64/nat64 article here.

According to Apple: "The easiest way to test your app for IPv6 DNS64/NAT64 compatibility—which is the type of network most cellular carriers are deploying—is to set up a local IPv6 DNS64/NAT64 network with your Mac. You can then connect to this network from your other devices for testing purposes" full link can be found here.

enter image description here

P.S If you're using the sendAsynchronousRequest method you'll need to change it to [NSURLSession dataTaskWithRequest:completionHandler:] since it got deprecated.

Avi Levin
  • 1,868
  • 23
  • 32
  • I think NSURLConnection is acceptable api for ipv6 and sendAsynchronousRequest is member of NSURLConnection, hence it should work.So why do we need to change it? – Saggy Jun 07 '17 at 12:25
  • @Saggy sendAsynchronousRequest:queue:completionHandler: is deprecated since iOS9. See this: https://developer.apple.com/documentation/foundation/nsurlconnection/1418125-sendasynchronousrequest?language=objc You need to change it in order to support ios9 and above. In general, there isn't any issue with NSURLConnection with ipv6. – Avi Levin Jun 07 '17 at 13:29
3

I create a IPv6 environment based on this post, and test the main project managed now.

PS, the apple official document, Supporting IPv6 DNS64/NAT64 Networks has the same flow, teaching how to build a DNS64/NAT64, IPv6 only environment to test.

It seems fine when using AFNetworking library, and NSURLConnection related methods. But a 3rd party library used for P2P connection failed.


Press the Option key and click the Sharing. Sharing

Create NAT64 Network will appear when you press Option on the above picture. If it's not present there, back to above step, and remember to press the Option key.


iOS 8, IPv6 only issue

iOS 8 didn't have NAT64 support, so any iOS 8 device on an IPv6-only network would be hopelessly crippled. Based on that, I'm pretty sure that as long as your code uses the IPv4 APIs only when actually running on iOS 8 and earlier (i.e. run-time checks, not build-time checks), you should be fine.

AechoLiu
  • 17,522
  • 9
  • 100
  • 118