Post

Replies

Boosts

Views

Activity

[Packet Tunnel Provider iSO] onDemand rules issu
I've implemented a VPN app with Packet Tunnel Provider for iOS. My question is about the onDemandRules: I want the device connect automatically to the VPN when a network is available and when the network become available after the reboot of iOS. For this, I use the following code and it works : let onDemandRule = NEOnDemandRuleConnect()       onDemandRule.interfaceTypeMatch = .any       newManager.isOnDemandEnabled = true       newManager.onDemandRules = [onDemandRule] I also want some websites not to go through the VPN For this, I have tested this onDemand configuration and it seem to work: let onDemandRuleEvaluate = NEOnDemandRuleEvaluateConnection()       let evaluateRule = NEEvaluateConnectionRule(matchDomains: ["site.example.com"], andAction: .neverConnect)       onDemandRuleEvaluate.connectionRules = [evaluateRule]       newManager.isOnDemandEnabled = true       newManager.onDemandRules = [onDemandRuleEvaluate] But if I add these 2 rules as is : newManager.onDemandRules = [onDemandRule, onDemandRuleEvaluate], only the first rule work.  Why?  How can I do to have these 2 rules in my onDemand configuration?
3
0
583
Dec ’21