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 . please help. thanks in advance.
I found Solution for my question for the
NEVPNManager
instances.When using this to the app developer must need its related certificates in which The
APPID
has has enabled theVPN 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. (also this is fromNetworkExtension.framework
which is available foriOS8
& higher devices)May be this can help anyone who is having the same issue.