请看下面的代码。每当我在运行iPhone 7的iOS 5c上运行这段代码时,就会在让管理器上得到一个EXC_BAD_ACCESS错误: NEVPNManager = NEVPNManager.sharedManager()行。
我该怎么解决这个问题,还是有办法解决这个问题?
提前谢谢。
let manager: NEVPNManager = NEVPNManager.sharedManager()
var p = NEVPNProtocolIPSec()
manager.`protocol` = p
let pw = "pw";
p.username = "un"
p.passwordReference = pw.dataUsingEncoding(NSUTF8StringEncoding)
p.serverAddress = "server"
p.authenticationMethod = NEVPNIKEAuthenticationMethod.SharedSecret
//p.sharedSecretReference = getPasscodeNSData("vpnSharedSecret")
p.useExtendedAuthentication = true
p.disconnectOnSleep = false发布于 2015-06-20 11:23:08
这是因为NEVPNManager是在iOS8添加的,正如您在苹果文档NetworkExtension变化中看到的那样
iOS 8.0API差异 NEVPNManager.h (增加) 添加NEVPNManager 添加NEVPNManager.connection 添加NEVPNManager.enabled 添加了-NEVPNManager loadFromPreferencesWithCompletionHandler: 添加NEVPNManager.localizedDescription 添加NEVPNManager.onDemandEnabled 添加NEVPNManager.onDemandRules 添加NEVPNManager.protocol 添加了-NEVPNManager removeFromPreferencesWithCompletionHandler: 添加了-NEVPNManager saveToPreferencesWithCompletionHandler: 添加+NEVPNManager sharedManager 添加NEVPNConfigurationChangeNotification 添加NEVPNError 添加NEVPNErrorConfigurationDisabled 添加NEVPNErrorConfigurationInvalid 添加NEVPNErrorConfigurationStale 添加NEVPNErrorConnectionFailed 添加NEVPNErrorDomain 添加#def NEVPN_EXPORT
https://stackoverflow.com/questions/30953038
复制相似问题