I am working on an application where there is a need to do a specific API only through Mobile Data and not wifi, allowing other API calls to be done using the available network type whether cellular data or wifi or ....
Is there a way to force use Mobile data usage even if WIFI is ON on this API call.
After opening a ticket with apple developer this was their reply:
Yes. When using Network Framework, take a look at requiredInterfaceType on NWConnection. For higher level APIs like URLSession, this would be an Enhancement Request.
Yet i am still stuck and do not know how to proceed.
You can get a bit of control here by setting the
allowsConstrainedNetworkAccess
orallowsExpensiveNetworkAccess
on yourURLRequest
s on iOS 13 (and same year Apple OSes) and above.allowsConstrainedNetworkAccess
:allowsExpensiveNetworkAccess
: