Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
startVPNTunnel()不';我不能在iOS 14上工作_Ios_Swift_Vpn - Fatal编程技术网

startVPNTunnel()不';我不能在iOS 14上工作

startVPNTunnel()不';我不能在iOS 14上工作,ios,swift,vpn,Ios,Swift,Vpn,由于iOS 14发布的startVPNTunnel()已停止工作,且应用程序未创建VPN连接 我的配置如下: private func _save(_ account: VPNServer, completion: VPNConfigureCompletion?) { let keychain = Keychain(service: Bundle.main.bundleIdentifier!) keychain["sharedSecret"]

由于iOS 14发布的startVPNTunnel()已停止工作,且应用程序未创建VPN连接

我的配置如下:

 private func _save(_ account: VPNServer, completion: VPNConfigureCompletion?) {
        let keychain = Keychain(service: Bundle.main.bundleIdentifier!)
        keychain["sharedSecret"] = account.key
        let ikev2Protocol = NEVPNProtocolIKEv2()
        ikev2Protocol.useExtendedAuthentication = false
        ikev2Protocol.authenticationMethod = .sharedSecret
        ikev2Protocol.disconnectOnSleep = false
        ikev2Protocol.serverAddress = account.ip
        ikev2Protocol.sharedSecretReference = keychain[attributes: "sharedSecret"]?.persistentRef
        ikev2Protocol.remoteIdentifier = account.ip

        if #available(iOS 13.0, *) {
            ikev2Protocol.enableFallback = true
        }

        vpnManager.protocolConfiguration = ikev2Protocol
        vpnManager.isEnabled = true
        vpnManager.saveToPreferences { error in
            if let err = error {
                print("Failed to save profile: \(err.localizedDescription)")
                self.delegate?.setConnectionStatus(status: .disconnected)
                NotificationCenter.default.post(name: NSNotification.Name.NEVPNStatusDidChange, object: "Failed to save profile")
            } else {
                completion?()
            }
        }
    }
此代码保存配置,但当您尝试连接时,它会抛出(即使在iPhone设置中手动)。它在iOS 13上运行正常。我们已经尝试使服务器与IPv6兼容,但没有成功。我还尝试添加VPN.IKEv2.ChildSecurityAssociationParameters,但没有成功。 有人有解决办法吗