Instance Method


Send a message to the Tunnel Provider extension. If the extension is not running, it should be launched to handle the message. If this method can’t start sending the message it reports an error in the returnError parameter. If an error occurs while sending the message or returning the result, nil should be sent to the response handler as notification.


func sendProviderMessage(_ messageData: Data, responseHandler: ((Data?) -> Void)? = nil) throws



An NSData object containing the message to be sent.


If the message was sent successfully, this parameter is set to nil. Otherwise this parameter is set to the error that occurred. Possible errors include:

  • NEVPNErrorConfigurationInvalid

  • NEVPNErrorConfigurationDisabled


An optional block that handles the response from the Tunnel Provider extension. Pass nil if no response is expected.

Return Value

Returns true if the message was sent successfully, or false if an error occurred.