Is there a way to interact with IOT device using Wi-FI and cloud using
cellular data (3G/4G)?
That depends on your specific requirements. I’m presuming that your accessory publishes a Wi-Fi network. When iOS joins that network, it will check to see if it leads to the wider Internet. If it does, it will set the default route to that network. If it doesn’t, the behaviour depends on how the join was triggered:
If it was an auto join, iOS will shortly thereafter leave the network.
If it was a manual join, iOS will stay on the network but leave the default route set to WWAN. In that case it’ll eventually leave the network the next time Wi-Fi is re-evaluated (for example, when you screen lock the device).
In the first case, you can still access WWAN but only with certain APIs. Two common examples:
In Network framework you can set requiredInterfaceType to force the connection to run over WWAN.
That's not the case with NSURLSession. You can set allowsCellularAccess to force the connection to avoid WWAN, but there’s no opposite setting.
In the second case things generally work out OK. The fact that the default route points to WWAN is irrelevant because you typically connect to an IP address (or
.local DNS name) and that’s sufficient to run the connection over Wi-Fi.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"