Instance Method

sendProviderMessage(_:responseHandler:)

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.

Declaration

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

Parameters

messageData

An NSData object containing the message to be sent.

error

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

responseHandler

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.

Discussion

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