Start the process of connecting the VPN
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
Framework
- Network
Extension
Declaration
Parameters
options
An
NSDictionary
that will be passed to the tunnel provider during the process of starting the tunnel. See Constants, below.error
A pointer to a pointer to an
NSError
object. If specified and the VPN connection process cannot be started due to an error, this parameter will be set to point to anNSError
object containing details about the error.
Return Value
true
if the process of connecting the VPN started successfully, false
if an error occurred.
Discussion
This method returns immediately after starting the process of connecting the VPN. In order to be notified when the VPN is fully connected, register to observe the NEVPNStatus
notification on the NEVPNConnection
object, and examine the status property when the notification is received.
Handling Errors in Swift:
In Swift, this method returns Void
and is marked with the throws
keyword to indicate that it throws an error in cases of failure.
You call this method in a try
expression and handle any errors in the catch
clauses of a do
statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.