title: Error on NEVPNManager.saveToPreferencesWithCompletionHandler
body: <p>My target platform is OS X 10.10 / Xcode 7.2
  I'm trying to  save the preference for NEVPNManager and I got an error in the domain=NEConfigurationErrorDomain:</p>
  
  <pre><code>Error Domain = NEConfigurationErrorDomain Code = 10 "permission denied" UserInfo = 0x610000073280 {NSLocalizedDescription = permission denied}
  </code></pre>
  
  <p>The sample code below:</p>
  
  <pre><code>let manager = NEVPNManager.sharedManager()
  manager.loadFromPreferencesWithCompletionHandler { (error) -&gt; Void in
      if((error) != nil) {
          print("VPN load preferences error")
          print(error!)
          exit(0)
      }
      if manager.`protocol`  == nil {
          let proto = NEVPNProtocolIKEv2()
          proto.serverAddress = "host.net"
          proto.username = "username"
          Keychain.save("vpnpassword", data: "password".dataUsingEncoding(NSUTF8StringEncoding)!)
          proto.passwordReference = Keychain.load("vpnpassword") // I got the same error without passwordReference too
          proto.authenticationMethod = NEVPNIKEAuthenticationMethod.None
          manager.`protocol` = proto
          manager.enabled = true
          manager.localizedDescription = "VPN"
          manager.saveToPreferencesWithCompletionHandler({ (error) -&gt; Void in
              if((error) != nil) {
                  print("VPN Save to Preferences error")
                  print(error!)
                  exit(0)
              }
              else {
                  do {
                      try manager.connection.startVPNTunnel()
                      print("Started error")
                  } catch {
                      print("Unexpected error")
                      }
                  }
              }
          })
      }
  })
  </code></pre>
  
  <p>Also I found next log entries:</p>
  
  <pre><code>Jan 10 14:24:51 y.local nehelper[196]: app has the com.apple.developer.networking.vpn.api entitlement but not the application-identifier entitlement
  Jan 10 14:24:51 y.local nehelper[196]: app Failed to obtain authorization right for 3: no authorization provided
  Jan 10 14:24:51 y.local app[33627]: __55-[NEVPNManager saveToPreferencesWithCompletionHandler:]_block_invoke142: failed to save the new configuration: Error Domain=NEConfigurationErrorDomain Code=10 "permission denied" UserInfo=0x608000660240 {NSLocalizedDescription=permission denied}
  </code></pre>
  
  <p>I have next entitlements</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
      &lt;key&gt;com.apple.application-identifier&lt;/key&gt;
      &lt;string&gt;T76ZSM474A.app&lt;/string&gt;
      &lt;key&gt;com.apple.developer.aps-environment&lt;/key&gt;
      &lt;string&gt;development&lt;/string&gt;
      &lt;key&gt;com.apple.developer.networking.vpn.api&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;allow-vpn&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;com.apple.developer.team-identifier&lt;/key&gt;
      &lt;string&gt;T76ZSM474A&lt;/string&gt;
      &lt;key&gt;com.apple.security.application-groups&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;T76ZSM474A.&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;keychain-access-groups&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;T76ZSM474A.group&lt;/string&gt;
      &lt;/array&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>And next xcent</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
    &lt;key&gt;com.apple.application-identifier&lt;/key&gt;
    &lt;string&gt;T76ZSM474A.vpn&lt;/string&gt;
    &lt;key&gt;com.apple.developer.aps-environment&lt;/key&gt;
    &lt;string&gt;development&lt;/string&gt;
    &lt;key&gt;com.apple.developer.networking.vpn.api&lt;/key&gt;
    &lt;array&gt;
    &lt;string&gt;allow-vpn&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;com.apple.developer.team-identifier&lt;/key&gt;
    &lt;string&gt;T76ZSM474A&lt;/string&gt;
    &lt;key&gt;com.apple.security.application-groups&lt;/key&gt;
    &lt;array&gt;
    &lt;string&gt;T76ZSM474A.&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;keychain-access-groups&lt;/key&gt;
    &lt;array&gt;
    &lt;string&gt;T76ZSM474A.group&lt;/string&gt;
    &lt;/array&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>embedded.provisionprofile has allow-vpn and correct team id (T76ZSM474A)</p>
  
  <p>Builded app has next codesign output</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
      &lt;key&gt;com.apple.application-identifier&lt;/key&gt;
      &lt;string&gt;T76ZSM474A.app&lt;/string&gt;
      &lt;key&gt;com.apple.developer.aps-environment&lt;/key&gt;
      &lt;string&gt;development&lt;/string&gt;
      &lt;key&gt;com.apple.developer.networking.vpn.api&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;allow-vpn&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;com.apple.developer.team-identifier&lt;/key&gt;
      &lt;string&gt;T76ZSM474A&lt;/string&gt;
      &lt;key&gt;com.apple.security.application-groups&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;T76ZSM474A.&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;keychain-access-groups&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;T76ZSM474A.group&lt;/string&gt;
      &lt;/array&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>I tried to decompile Network.framework, but it isn't easy.
  I checked this problem on OS X 10.11 and I didn't found problem, my app works correctly.
  I copied builded app from OS X 10.11 to OS X 10.10 and I got previous error.
  I think that documentation has an error and NEVPNManager not supported in OS X 10.10 or NEVPNManager on OS X 10.10 has a bug.</p>
  
  <p>What did I wrong?</p>