Connect to Vpn Programmatically in iOS 8

Connect to VPN programmatically in iOS 8

The problem is the error you are getting when saving:
Save error: Error Domain=NEVPNErrorDomain Code=4

If you look in the NEVPNManager.h header file, you will see that error code 4 is "NEVPNErrorConfigurationStale". The configuration is stale and needs to be loaded.
You should call loadFromPreferencesWithCompletionHandler: and in the completion handler modify the values you want to modify, and then call saveToPreferencesWithCompletionHandler:. The example in your question is modifying the configuration before the loading is completed, which is why you are getting this error.

More like this:

[manager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
// do config stuff
[manager saveToPreferencesWithCompletionHandler:^(NSError *error) {
}];
}];

Use iOS 8 network extension to install signed VPN profiles programmatically

The Network Extension framework in iOS 8 creates profiles that are unsigned and there is no option currently to get the profiles to show as signed/verified. Would definitely write a bug report against Apple about this.

Use iOS 8 network extension to install signed VPN profiles programmatically

The Network Extension framework in iOS 8 creates profiles that are unsigned and there is no option currently to get the profiles to show as signed/verified. Would definitely write a bug report against Apple about this.

Set VPN connection on iOS programmatically or openVPN source code

Yes you can configure VPN programmatically from your IOS app. IOS 8 has added a new framework called network extension framework which provides some API's for developers to configure VPN programatically. Please refer the this blog

IOS cannot set VPN programmatically

  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];



Related Topics



Leave a reply



Submit