我尝试在 iOS 14 beta 上运行我的应用程序。它在 iOS 13 上运行良好,但无法连接到 iOS 14 beta 上的任何服务器。NEVPNManager.shared().connection.startVPNTunnel() 不会引发任何错误,并且 NEVPNStatus 与我连接的任何服务器变为 .disconnected。我在 iOS 14 上找不到 NEVPNManager 的变化。
这是我的经理的配置:
let p = NEVPNProtocolIKEv2()
p.authenticationMethod = NEVPNIKEAuthenticationMethod.none
p.serverAddress = account.server
p.disconnectOnSleep = false
p.deadPeerDetectionRate = NEVPNIKEv2DeadPeerDetectionRate.medium
p.username = account.account
p.passwordReference = KeychainWrapper.passwordRefForVPNID()
p.disableMOBIKE = false
p.disableRedirect = false
p.enableRevocationCheck = false
p.enablePFS = false
p.useExtendedAuthentication = true
p.useConfigurationAttributeInternalIPSubnet = false
p.remoteIdentifier = account.server
p.localIdentifier = account.account
let manager = NEVPNManager.shared()
manager.protocolConfiguration = p
manager.isEnabled = true
let ruleConnect = NEOnDemandRuleConnect()
ruleConnect.probeURL = account.probeUrl
manager.onDemandRules = [ruleConnect]
manager.isOnDemandEnabled = true