NEVPNManager 停止使用 iOS 14 beta

NEVPNManager stop working with iOS 14 beta

我已经尝试 运行 我的应用在 iOS 14 测试版上。它在 iOS 13 上运行良好,但无法连接到 iOS 14 测试版上的任何服务器。 NEVPNManager.shared().connection.startVPNTunnel() 不会抛出任何错误,并且 NEVPNStatus 会与我连接的任何服务器断开连接。我在 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

A​​pple 似乎在 iOS 14 上更改了密码(有记录),您可以在此处查看一些线程:

https://developer.apple.com/forums/thread/659209
https://developer.apple.com/forums/thread/657792
https://developer.apple.com/forums/thread/657792
https://developer.apple.com/forums/thread/661298?page=2

如果你像我一样使用 StrongSwan,你可以通过从你的 VPN 服务器更新配置来修复它,只需设置 ike=aes256-sha2_256-modp2048esp=aes256-sha2_256,然后重新启动 StrongSwan,然后它适用于 iOS 14. 参考:https://wiki.strongswan.org/projects/strongswan/wiki/AppleClients