I am using the code below (Swift 3 and Swift 4 compatible) to check the VPN connection on iOS devices which is not working in iOS 12 and above. How can I check the vpn connectivity in iOS 12
func isVPNConnected() -> Bool {
let cfDict = CFNetworkCopySystemProxySettings()
let nsDict = cfDict!.takeRetainedValue() as NSDictionary
let keys = nsDict["__SCOPED__"] as! NSDictionary
for key: String in keys.allKeys as! [String] {
if (key == "tap" || key == "tun" || key == "ppp" || key == "ipsec" || key == "ipsec0") {
return true
}
}
return false
}
Thank you for your help.