Failed to create IKEV2 using code

p.authenticationMethod = NEVPNIKEAuthenticationMethodSharedSecret; p.sharedSecretReference = [self searchKeychainCopyMatching:@"PSK"];

Failed to create IKEV2 using PSK, and the following error message is displayed:

Start VPN failed: [The operation couldn’t be completed. (NEVPNErrorDomain error 1.)]

May I ask what the reason is?

May I ask what the reason is?

There’s a wide range of possibilities here. Error 1 in the NEVPNErrorDomain domain is NEVPNErrorConfigurationInvalid. My general advice is:

  1. First test your VPN using a configuration profile. If you can’t get it working with a configuration profile, you won’t be able to get it working via the Personal VPN API. An easy way to create a profile for testing is the Apple Configurator app.

  2. Once you have that working, use the Personal VPN API to apply the same configuration programmatically.

With regards step 2, most problems I see in this space relate to the keychain. I have a code snippet that shows how to do this right in this post.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Failed to create IKEV2 using code
 
 
Q