Do you actually need to resolve the name to IP addresses? In most cases you can pass the name to a connect-by-name API and it will resolve internally. That’s what I recommend in general, partly because it’s less code and partly because it handles various non-obvious edge cases.
If you really do need to resolve the address (you’re working with UDP, say), you can call any DNS resolving routine and it will handle
foo.local.
names correctly. The two most common choices are:
Make sure you handle both IPv4 and IPv6 results; IPv6 results are especially common when dealing with local names.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"