Reputation: 711
I am trying to configure vpn programatically using NEVPNManager and i was successful upto saving the preferences , but i am getting error "negotiation with the VPN server failed" when i try to connect. Is there anything to do specific in protocolConfiguration to make it working??
Thanks in advance.
Upvotes: 1
Views: 715
Reputation: 1
Make sure your are setting the VPN config properly. Here is the sample code.
NEVPNProtocolIPSec *protocalConfigurationIPSec = [[NEVPNProtocolIPSec alloc] init]; protocalConfigurationIPSec.username = @"account";
protocalConfigurationIPSec.passwordReference = passwordReference;
protocalConfigurationIPSec.serverAddress = @"ipaddress";
protocalConfigurationIPSec.authenticationMethod = NEVPNIKEAuthenticationMethodSharedSecret;
protocalConfigurationIPSec.sharedSecretReference = sharedSecretReference;
protocalConfigurationIPSec.localIdentifier = @"userGroup"];
protocalConfigurationIPSec.remoteIdentifier = [serverDict objectForKey:@"userGroup";
**protocalConfigurationIPSec.useExtendedAuthentication = YES;**
protocalConfigurationIPSec.disconnectOnSleep = NO;
manager.protocolConfiguration=protocalConfigurationIPSec;
[manager setOnDemandEnabled:NO];
[manager setLocalizedDescription:@"VPN"];
manager.enabled = true;
Upvotes: 0