Shahabaz Khan
Shahabaz Khan

Reputation: 21

How to handle IPv4 Address literals for IPv6-only network in iOS8

I am implementing my application to be compatible for IPv6-only networks. Is there any way to handle the hardcoded IPv4 address literals (such as 172.1.2.3) in iOS8.x ?

As per the apple documentation,

- In iOS 9 and later, NSURLSession and CFNetwork automatically synthesizes IPv6 addresses from IPv4 literals locally on devices operating on DNS64/NAT64 networks.

- The ability to synthesize IPv6 addresses was added to getaddrinfo() in iOS 9.2.

But there is no mention of how to handle address literals for iOS8.x.

Upvotes: 2

Views: 2333

Answers (1)

Sander Steffann
Sander Steffann

Reputation: 9978

Correct. Users using ancient iOS versions on modern networks connecting to legacy services will have connectivity problems. The best solutions are to:

  • Never use hard-coded addresses in your code
    • There are many excellent reasons, just don't hard-code addresses and use DNS
    • If you use DNS then the NAT64 provider will handle the translation for you
  • Make sure that your servers are reachable over both IPv4 and IPv6
    • This makes the reachability of your service much better
    • It makes NAT64 unnecessary, uses can just use native IPv6 without any hacks

If you want to run a good service and write a good App, do both of the above.

Upvotes: 1

Related Questions