nevpnmanager

NEVPNManager Connect to VPN in Swift

柔情痞子 提交于 2019-12-03 03:51:33
I can't find a clear answer on how to do this, so that's why I created this thread. I'm developing a Swift application (Swift 2), where I want to connect with an VPN Server using a function. So I want to create a func connect() { //Handle the connection to the VPN } I received this https://gist.github.com/matthijsotterloo/cedf256f7f1c2a9a8f624481b7083afd file from the developer who made the VPN (of course I replaced certs,keys,url's and login's. Now my question is how can I connect to this VPN server in the function? I already found out I have to use the NEVPNManager but I can't really find

“Error Domain=NEVPNErrorDomain Code=1 \\”(null)\\“” While connecting VPN server

让人想犯罪 __ 提交于 2019-11-30 22:42:58
I'm getting "Error Domain=NEVPNErrorDomain Code=1 \"(null)\"" only first time while connecting to VPN server, later onwards it works perfectly. I've checked NEVPNErrorDomain Error 1 when trying to start TunnelProvider network extension similar to my problem and followed the way its said in this solution but still getting same error. So here is my code for connecting to VPN Server using Network Extension. func initVPNTunnelProviderManager(){ self.vpnManager.loadFromPreferences { (error) -> Void in if((error) != nil) { print("VPN Preferences error: 1") } else { let p = NEVPNProtocolIKEv2() p