Reputation: 1193
I am a newer for iOS Network Extension. I am trying to make an application that manage VPN connection.
Once VPN connected, this should be connected at any condition (After restarting device or changed Mobile connection (Wifi to Cellular, Cellular to Wifi)).
Always VPN should be connected automatically.
I have read about Always-On VPN article: https://help.apple.com/deployment/ios/#/iore8b083096
This is not option for me. Because it requires device supervision.
So, Now I am at good solution on "VPN On Demand".
How can I set up VPN always connects automatically at any condition ?
Thank you.
Upvotes: 3
Views: 1716
Reputation: 6150
Set on demand to true, and use the connect rule:
let newManager = NETunnelProviderManager()
newManager.isOnDemandEnabled = true
newManager.onDemandRules = [NEOnDemandRuleConnect()]
Upvotes: 5