我的vpn偏好配置如下:
let newIPSec = NEVPNProtocolIPSec()
newIPSec.serverAddress = AppConfiguration.getVPNEndPoint()
newIPSec.authenticationMethod = NEVPNIKEAuthenticationMethod.sharedSecret
newIPSec.username = VPNCredentialsModel.instance.vpnUserName()
newIPSec.passwordReference = VPNCredentialsModel.instance.vpnPasswordReference() as Data?
newIPSec.sharedSecretReference = VPNCredentialsModel.instance.vpnPresharedKeyReference() as Data?
newIPSec.useExtendedAuthentication = true
self.manager.protocolConfiguration = newIPSec
let disconnectRule = NEOnDemandRuleDisconnect()
disconnectRule.probeURL = URL(string:VPNCredentialsModel.instance.vpnProbeURL()!)
self.manager.onDemandRules = [disconnectRule]
self.manager.isOnDemandEnabled = true
self.manager.isEnabled = true
连接确实通过但是当设备进入睡眠或空闲模式以及VPN关闭时。当设备启动与Internet的连接时,预期的行为是启动VPN连接。但这似乎并没有发生。我知道在iOS 9中VPN被破坏了,我希望在iOS 10中解决这个问题。还有其他人看到这个问题吗?