1 Reply
      Latest reply on Dec 8, 2017 12:29 AM by eskimo
      DanLycan Level 1 Level 1 (0 points)

        Is there a way to make sure a specific HTTP request on an iPhone goes over the LTE network, even when the iPhone is connected to wifi? 

         

        Based on the thread https://forums.developer.apple.com/thread/13164 it looks like there may be way using bind to force the app to a socket that is tied to the LTE network, is that right?

         

        Is there iOS API's we should look at force the request over LTE? The only thing I've found so far is https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1409406-allowscellularaccess?language=objc which can turn off access to the cellular network, but I haven't found the equivalent for turning off access to wifi.

         

        Anything else we should keep in mind?

         

        Thanks in advance

        • Re: Is there a way to make sure a specific HTTP request on an iPhone goes over the LTE network?
          eskimo Apple Staff Apple Staff (12,095 points)

          Is there a way to make sure a specific HTTP request on an iPhone goes over the LTE network, even when the iPhone is connected to wifi?

          That depends on the API you’re using.  If you’re using a high-level API, like NSURLSession, there’s no way to force the request to run over a specific interface [1].  If you’re using a low-level API, specifically BSD Sockets, you can do this by binding the socket’s source address.  Alas, there’s some serious gotchas with this approach, as I discussed in the thread you referenced.

          If you'd like to see better support for this added to NSURLSession in the future, I encourage you to file an enhancement request describing your requirements.  While we may have seen similar requests before, a fresh bug report will allow you to express your needs in your own terms, and allow the CFNetwork team to gauge the level of demand.

          Please post your bug number, just for the record.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          [1] There two edge cases here:

          • You can stop it running over WWAN via the allowsCellularAccess property, but that technically doesn’t force it to run over a specific interface: it could run over Wi-Fi or Ethernet (yes, even on iOS).

          • Hotspot helpers can force a request to run over the specific interface associated with the hotspot (see -bindToHotspotHelperCommand: in <NetworkExtension/NEHotspotHelper.h>) but that’s not a generally available feature.