I have problem with VPN on ios. I use this code.
let result = NEOnDemandRuleConnect()
result.interfaceTypeMatch = .any
manager.onDemandRules = [result]
manager.isOnDemandEnabled = true
Sometimes, if I unlock iphone after 1-2 hours of sleep, VPN is not working. VPN icon in status bar is shown, wifi connection icon is shown, but network is not working (I can't load any page in safari). If I manually reconnect VPN in app or in system settings - it starts to work correctly. I'm using ipsec protocol.
How can I fix this problem?
We solved an issue in other way - we replaced ipsec with ikev2 and now VPN is working correctly.