0 Replies
      Latest reply on Feb 12, 2020 4:42 PM by davinderfromzirakpur
      davinderfromzirakpur Level 1 Level 1 (0 points)

        I am using NetworkExtension and creating/managing a Personal VPN configuration that uses IKEv2 built-in VPN protocol.

        When I connect the VPN from my app it give me connectedDate from that i am getting time stamp to show the timer like 00:00:00 which will start when the VPN is connected

        After connecting VPN I put the app in the background, Then I open the settings app and I disconnect and connect the VPN again from the General->VPN. After that when I open the app again the connectedDate I am getting is still the same(first time VPN connected).


        My VPN profile is configured successfully and I am calling loadTheVPNPreferencesOnly() in applicationDidBecomeActive

        func loadTheVPNPreferencesOnly() {
          NEVPNManager.shared().loadFromPreferences { (error) in
          if error != nil {
          else {
          print("No error from loading VPN viewDidLoad")
          print("adding NEVPNStatusDidChange Observer.... ")



        I also tried like this, But the
        connectedDate is still previous one:
        let VPNConnecteddate = NEVPNManager.shared().connection.connectedDate
        //print(VPNConnecteddate as? Date) // 2020-01-30 14:46:56 +0000
        let VPNTimeStamp = VPNConnecteddate?.timeIntervalSince1970
        if VPNTimeStamp != nil {

          CommonMethod.saveUserDefault(key: "vpnTimeStamp", value: VPNTimeStamp)

          print("VPNTimeStamp===> \(VPNTimeStamp)")

        I will really appreciate if someone helps me on this point. I have searched a lot for checking this online.

        Links you can take as reference: