Instance Method


Stop the network tunnel.


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



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


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


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

func cancelTunnelWithError(Error?)

Stop the network tunnel from the Packet Tunnel Provider.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software