IOS cannot set VPN programmatically

2019-01-26 22:38发布

问题:


Kindly asking for help - I've tried to implements things, described in this great post; also I've read tons of different info on internet - but I still can't create VPN and make it work.
I've tried also to download ready .mobileconfig files - they are installed ok, but I'm not able to manage them from my app.
If possible - can you share working code? Certainly, without your credentials - I'll replace them with my one's.

What do I need - simple app, that allows to install/edit and enable/disable VPN connection (at this moment at least pptp and l2tp).
Great thanks in advance.

回答1:

  1. As far as I know, in iOS you can only set programmatically VPN connection with only IPSec and IKEv2 protocols
  2. For me it was very helpful to find this great example of such application https://github.com/lexrus/VPNOn where you can find the examples of both available types of connections to VPN. I think critical point in creating of VPN connection is to provide valid keychain references to your credentials:

p.passwordReference = [VPN user password from keychain];

p.sharedSecretReference = [VPN server shared secret from keychain];



标签: ios vpn