27 May 2016
Apple iOS and the IPv6 deadline
Starting on June 1, 2016, Apple will start enforcing a new policy that you may need to be aware of. If your app does any networking – opening a WebView, doing a network.request(), or using LuaSocket to talk to another server or device – then read on. If you’re not, you simply need to know the following:
TL/DR: All apps have to be IPv6 compliant after June 1, 2016.
A little history
For a long time, the Internet has used a four-byte (
255) IP address to represent each connected device. In network jargon, this is known as IPv4. You’re probably familiar with them as they look like
192.168.1.15. This pool of numbers is a worldwide resource and the Internet has run out of them.
For the past several years, the Internet has been moving to a different way to give your computer, phone, tablet, and smart device a unique address. This new system is known as IPv6 and it has a considerably larger pool of numbers which shouldn’t run out for a very long time.
Since the Internet is out of IPv4 addresses, there are now some resources that are only identified by their IPv6 addresses. Apple wants to make sure your apps all work with the new networking numbers. Starting on June 1, 2016, any newly submitted or updated apps must work on networks that only allow IPv6 addresses.
What does this mean for you?
You can no longer use IP addresses instead of server names. This applies to every kind of networking from WebViews to socket calls. Sometimes, it is just easier to use the IP address of a server (i.e.
192.168.212.15) instead of a server name (i.e.
www.example.com), but this is no longer allowed. If you’re currently using IP addresses for your servers and need to switch, do an Internet search for dynamic dns and you’ll find a variety of services that will map server names to your IP addresses. If you have a domain name already, check out the DNS setup at your registrar which will let you set up your own mappings.
Corona SDK has two lower-level networking layers that your apps may be utilizing: the network.* API calls and the socket.* library. The network.* API calls have been IPv6 compatible for some time. If you’re using the latest public build and only use these functions, you should be in good shape from a Corona perspective. However, if you are connecting to servers using their IP addresses instead of a server name, you will need to stop using the IP address and use a server name instead.
How do you know if you’re using sockets?
If you are using third-party plugins or libraries, then you may need to make sure they work as expected. If you are doing any peer-to-peer connectivity (where to devices talk to each other without going through a network server), or are implementing your own FTP file transfer, then the library you’re using may need updating to avoid using IP addresses.
If you’re using LuaSocket, let’s look at some typical code that needs to be changed:
local socket = require( "socket" )
local serverName = "ipv4.test-ipv6.com"
local server_address, mesg = socket.dns.toip( serverName ) -- IPv4
print( "server_address: ", serverName, server_address, mesg )
socket.dns.toip() call only works for IPv4 addresses, it needs to be changed to the more modern equivalent:
local socket = require( "socket" )
local serverName = "ipv6.test-ipv6.com"
local addr_info, mesg = socket.dns.getaddrinfo( serverName )
print( "server_address: ", addr_info.addr, mesg )
If you’ve already changed over to (or started with) the more modern
socket.dns.getaddrinfo() style calls, then you should be good to go.
iOS will be able to talk to IPv4 sites for the foreseeable future. However, if the only way your app uses the Internet is with IPv4, then Apple will not approve your app or any updates to it. Apple will not be taking any apps down, so you do not need to update existing apps. But any updates you do submit or new apps will be subject to this policy.
To learn more, read Apple’s developer documentation on the issue.