Switch ON / OFF VPN when device connects to a wifi-network

Hi,

we are developing an iOS application that should do the following tasks:

  1. Monitoring the network connection (we are actually using NWPathMonitor)
  2. When the device is not connected to a secure WIFI, active an our VPN, otherwise it has to switch-off VPN

Is this possibile to develop the 2nd step in an iOS environment for all app lifecycle states (foreground, background and even in the not running state)?

If it is possible, which API / Architecture we have to implement? Widgets could be a way?

Thanks in advance

I don’t think you’ll be able to make this work:

  • iOS does not allow arbitrary apps to run in the background indefinitely. I talk about this in depth in iOS Background Execution Limits.

  • There is no specific API that’ll resume (or relaunch) your app on Wi-Fi changes.

  • A common way forward here is to set up VPN On Demand rules but, AFAIK, there’s no VPN On Demand rule that checks for whether the current Wi-Fi is ‘secure’.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you very much for your reply, but I would ask you, however, what is meant by "ordinary app"? Am I to guess that "non-arbitrary" apps can have certain APIs unblocked? How can I make my app "non ordinary"?

I'm asking these questions because I've noticed other apps that somehow and ALWAYS seem to work fine even when the app is killed.

Thanks for the replies

what is meant by "ordinary app"?

Who are you quoting here? My post does not contain the term “ordinary app”.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Switch ON / OFF VPN when device connects to a wifi-network
 
 
Q