[英]NEVPNManager instance is showing nil
I had created network manager by using the below code.我使用以下代码创建了网络管理器。 but as soon the first line of call is run the manager is being nil so any other methods are getting not effected.
但是一旦第一行调用运行,管理器就会为零,因此任何其他方法都不会受到影响。 Can Anyone let me know that what wrong thing I had done ?
谁能让我知道我做错了什么?
NEVPNManager *manager = [NEVPNManager sharedManager];
NEVPNProtocolIPSec *p = [[NEVPNProtocolIPSec alloc] init];
p.username = @"MYUSERNAME";
p.passwordReference = [@"MYPW" dataUsingEncoding:NSUTF8StringEncoding];
p.serverAddress = @"[NetworkIP]";
p.authenticationMethod = NEVPNIKEAuthenticationMethodSharedSecret;
p.sharedSecretReference = [@"SharedSecretHashCode" dataUsingEncoding:NSUTF8StringEncoding];
[manager setProtocol:p];
[manager setOnDemandEnabled:NO];
[manager setLocalizedDescription:@"VIT VPN"];
NSArray *array = [NSArray new];
[manager setOnDemandRules: array];
NSLog(@"Connection desciption: %@", manager.localizedDescription);
NSLog(@"VPN status: %li", (long)manager.connection.status);
[manager saveToPreferencesWithCompletionHandler:^(NSError *error) {
if(error) {
NSLog(@"Save error: %@", error);
}
}];
" manager
" is being nil . “
manager
”为零。 please help.请帮忙。 thanks in advance.
提前致谢。
I found Solution for my question for the NEVPNManager
instances.我为
NEVPNManager
实例的问题找到了解决方案。
When using this to the app developer must need its related certificates in which The APPID
has has enabled the VPN Configuration & controls
.使用此功能时,应用程序开发人员必须需要其相关证书,其中
APPID
已启用VPN Configuration & controls
。 and this app must need to run in the device.并且此应用程序必须需要在设备中运行。
So the NEVPNManager
will not be nil and it can be adapt from the shared instance of the device.所以
NEVPNManager
不会为nil,它可以从设备的共享实例中适配。 (also this is from NetworkExtension.framework
which is available for iOS8
& higher devices) (也这是从
NetworkExtension.framework
前者可用于iOS8
与较高的装置)
May be this can help anyone who is having the same issue.可能这可以帮助遇到相同问题的任何人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.