1 Reply
      Latest reply: Nov 28, 2016 12:45 AM by eskimo RSS
      bwalle83 Level 1 Level 1 (0 points)

        Hello,

         

        I have some issue when implementing a custom tunnel provider and the media changes (from WiFi to Mobile and vice versa). For example when I disable WiFi, the WiFi symbol gets grey and no data is sent through the VPN tunnel. My application gets a timeout (using DPD), cancels the tunnel and the VPN on demand feature then starts a new tunnel.

         

        However, when I turn on WiFi but the tunnel is esablished using mobile network, then the WiFi is completely ignored until I manually reconnect.

         

        The built-in VPN client using a VPN on Demand rule doesn't have that issue.

         

        Is there some API (callback?) or setting that I'm missing? Is there a high-level API in the tunnel provider to detect network changes?

         

         

        Regards,

        Bernhard

        • Re: Network media change when using VPN on Demand
          eskimo Apple Staff Apple Staff (6,665 points)

          I’m not sure I fully understand your issue but I can tackle this part:

          Is there a high-level API in the tunnel provider to detect network changes?

          Yes.  Both NWTCPConnection and NWUDPSession have a hasBetterPath property you can observe to detect changes in network connectivity.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"