How to prevent iPhone from switching to mobile?

We build a remote type of app that consist of a macOS and iPhone part.

It relies on WiFi communication because Apple. Unfortunately iPhones sometimes switch from WiFi to Mobile and then the app communication is broken. Is there a solution for this? Can this been prevented? Any other real world solutions / suggestions?

Replies


iPhones sometimes switch from WiFi to Mobile and then the app communication is broken. Is there a solution for this? Can this been prevented?


Not programmatically from an app running on an iPhone. If you are targeting the enterprise, you can explore MDM solutions to restrict communications but you will have surmount other hurdles... so a solution redesign is probably in order and you'll have to seriously consider abandoning your current architecture and implementation.

Just as a follow up to my previous response... your tags list multiplier connectivity and the APIs in that framework were built prior to the Network.framework. While your app can't programmatically prevent the device from using cellular, the Network.framework does provide some flexibility to your app if you are able to redesign to restrict itself when it does not have the correct interface:

https://developer.apple.com/documentation/network/nwparameters/2998704-prohibitedinterfaces

prohibitedInterfaceTypes
A list of interface types that connections, listeners, and browsers will not use.


requiredInterfaceType
An interface type to require on connections and listeners.