I use NEVPNManager. I found that when the network status changes, the VPN disconnects. I tried using NEOnDemandRuleConnect to automatically reconnect, but there was a problem with the VPN not being able to disconnect manually. Because every time it disconnects, it automatically reconnects. What can be done about it?
NEOnDemandRuleConnect *connectRule = [[NEOnDemandRuleConnect alloc] init];
connectRule.interfaceTypeMatch = NEOnDemandRuleInterfaceTypeAny;
NEOnDemandRuleIgnore *ignoreRule = [[NEOnDemandRuleIgnore alloc] init];
ignoreRule.interfaceTypeMatch = NEOnDemandRuleInterfaceTypeAny;
[self.vpnManager setOnDemandRules:@[connectRule, ignoreRule]];
[self.vpnManager setOnDemandEnabled:YES];