Contents

stopTunnel(with:completionHandler:)

Stop the network tunnel.

Declaration

func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping  @Sendable () -> Void)
func stopTunnel(with reason: NEProviderStopReason) async

Parameters

  • reason:

    An NEProviderStopReason code indicating why the tunnel is being stopped. Possible codes are listed in Neprovider.

  • completionHandler:

    A block that must be executed when the tunnel is fully stopped.

Discussion

This method is called by the system to stop the network tunnel.

NEPacketTunnelProvider subclasses must override this method.

Do not use this method to stop the tunnel from the Packet Tunnel Provider. Use cancelTunnelWithError: instead.

See Also

Managing the tunnel life cycle