Switch from enterprise VPN to personal VPN issue

Just found an interesting problem related to VPN on iOS. Share my experience here in case anyone else has the same problem.


In an iOS application I created a personal VPN using NEVPNManager at first with IKEv2 type and it works fine.

And then remove this personal VPN and create an enterprise VPN using NETunnelProviderManager and it also works fine.


And then remove this enterprise VPN and create a personal VPN and now the problem comes, there is no VPN icon on the top status bar and it does not work. No network traffic routed to this VPN.


And after many experiments I found out 3 solutions to solve this problem:

  1. In the program keep the enterprise VPN and don't remove it. After the personal IKEv2 VPN is created then goto the VPN settings and enable the enterprise VPN and disable the onDemandRules of this enterprise VPN. Now the IKEv2 VPN will connect and work. Then you could remove the enterprise VPN safely;
  2. Reset network settings. After that and with reconnecting to network you'll find that personal VPN is connected;
  3. This one is the most interesting solution. In VPN settings just add a VPN configuration with every required field randomly input some characters then save it and enable it. You'll find that although this newly added VPN does not work but it triggers the personal VPN works!


And the above solutions seems can not be done programmatically. I'm not sure but it seems to be a bug of iOS.
If anyone have the answer of this problem please let me know.


--------------------------------


The above VPN configurations are added by saveToPreferences and switched programmatically instead of using configuration profiles. If using configuration profiles they can switch from one to another without any problems. The problem only occurs when programmatically switch between different type of VPNs.

Replies

I'm not sure but it seems to be a bug of iOS.

It’s definitely weird, and hence bugworthy IMO. Make sure to test on the current iOS 13 beta, just to confirm it’s still happening there.

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"

Thanks for your reply eskimo.


After installing iOS 13 beta 5 on iPhone SE and it still has the same problem. Installed Xcode 11 beta 5 and rebuild the whole project and tested on iOS 13 beta 5 on an iPhone SE and the problem of switching from enterprise VPN to personal VPN issue is still there.


Here's the link to the bug report:

https://feedbackassistant.apple.com/feedback/6948214