I want to create a onDemandRule for VPN connnection in ios
Requirement is as follows.
If Both cellular and wifi is available and wifi ssid = "ABC" than only VPN will run otherwise it should stop.
I have tried following OnDemandRule
let onDemandRule = NEOnDemandRuleConnect()
onDemandRule.interfaceTypeMatch = .wiFi
onDemandRule.ssidMatch = ["ABC"]
let onDemandRule1 = NEOnDemandRuleConnect()
onDemandRule1.interfaceTypeMatch = .cellular
self.vpnManager.isOnDemandEnabled = true
let onDemandRule2 = NEOnDemandRuleDisconnect()
onDemandRule2.interfaceTypeMatch = .any
self.vpnManager.onDemandRules = [onDemandRule, onDemandRule1, onDemandRule2]
It works as soon as i connect to a wifi named ABC
But it doesn't disconnect if i switch off cellular data. Can someone please let me know what i am doing wrong here.