Hello, I have the same question.
The user use the app normally for many times, and suddenly can't start the vpn service, the APP log show API "startVPNTunnelWithOptions" call success, and return success.But the TunnelExtension process is not running, and there is nothing in the logs I have logged in the PacketTunnelProvider.Is there a solution to this problem now?
[NETunnelProviderManager loadAllFromPreferencesWithCompletionHandler:^(NSArray<NETunnelProviderManager *> * _Nullable managers, NSError * _Nullable error) {
if (managers.count > 0) {
self.manager = [managers objectAtIndex:0];
self.manager.localizedDescription = @"APP-VPN";
self.manager.enabled = YES;
self.manager.onDemandEnabled = YES;
} else {
NETunnelProviderProtocol *protocol = [[NETunnelProviderProtocol alloc] init];
protocol.providerBundleIdentifier = @"com.***.***.extension";
protocol.serverAddress = controlUrl;
self.manager = [[NETunnelProviderManager alloc] init];
self.manager.protocolConfiguration = protocol;
self.manager.localizedDescription = @"APP-VPN";
self.manager.enabled = YES;
self.manager.onDemandEnabled = YES;
}
WS(weakSelf);
[self.manager saveToPreferencesWithCompletionHandler:^(NSError * __nullable error) {
SS(strongSelf);
if (error) {
NSLog(@"Error when saveToPreferencesWithCompletionHandler: %@", error);
} else {
[strongSelf.manager loadFromPreferencesWithCompletionHandler:^(NSError * _Nullable error) {
NSError *startError = nil;
BOOL isSucces = [strongSelf.manager.connection startVPNTunnelWithOptions:settDic andReturnError:&startError];
if (isSucces) {
NSLog(@"success");
} else {
NSLog(@"startError");
}
}];
}
}];
}];