【发布时间】:2017-06-04 04:22:19
【问题描述】:
这是我用来通过我的应用添加 VPN 配置的一些示例代码。我的问题是,我怎样才能添加代理配置。在设置应用程序和 Apple Configurator 中,用户可以添加代理设置(自动或手动)以及他们的 VPN 设置。
以下是我找到的一些示例代码,但我也找不到任何关于如何添加代理的线索。
let manager = NEVPNManager.shared()
manager.loadFromPreferences { (error) -> Void in
if manager.protocolConfiguration == nil {
let newIPSec = NEVPNProtocolIKEv2()
newIPSec.serverAddress = "mycompany.vpn"
newIPSec.username = "myvpnusername"
newIPSec.identityDataPassword = "myvpnpassword"
newIPSec.authenticationMethod = NEVPNIKEAuthenticationMethod.none
newIPSec.disconnectOnSleep = false
manager.protocolConfiguration = newIPSec
manager.isEnabled = true
manager.saveToPreferences(completionHandler: { (error) -> Void in
})
}
【问题讨论】:
标签: ios swift swift3 proxy nevpnmanager