How to call web service and stop VPN server in applicationWillTerminate Method?
I have implemented VPN Server logic (NETunnelProviderManager) and start tunnel on NETunnelProviderSession using startTunnel(options: ["ipv4": dnsIpv4]) method. VPN Working fine and started properly. I want to stop VPN tunnel in applicationWillTerminate(_ application: UIApplication) method when application terminating. I have also put code logic for that but it will not stop VPN And I also want to call API (Web-service) when application going to terminate.
func applicationWillTerminate(_ application: UIApplication){
//Stop VPN
self.vpnService.disable { (error) in
}
//Perform API Calling
self.myAPI()
}
iPhone 6s, iOS 10.1