Are there any APIs on iOS to resolve DNS via Cellular network when WiFi is also connected? As I connect my iPhone to WiFi, DNS will be resolved via WiFi not Cellular.
Low level APIs are preferred.
Thanks!
OK, well, I guess that rules out all the easy solutions )-:The network stack is cross-platform
Apple platforms don’t have high-level DNS APIs because we strongly encourage developers to use one of our connect-by-name APIs. The whole resolve-then-connect approach promulgated by BSD Sockets is fundamentally flawed:If there is a high-level API that only deal with the DNS on
multi-network, it's also great.
On Apple platforms specifically, the networking stack needs to know about your intention to connect in order to react appropriately. For example, early versions of iOS would shut down the WWAN when it was idle. When a client tried to connect to a DNS name on the other side of the WWAN interface, the system would bring it up automatically. However, it’s not appropriate to do that at the resolve step. This strategy has long since fallen by the wayside, we now keep the WWAN interface up where possible, but the same infrastructure is still used in a wide variety of other places on our platforms.
Even on non-Apple platforms, a best-of-class Happy Eyeballs implementation is really frikkin’ hard.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"