NEVPNManager is used to create and manage VPN configurations and to control the resulting VPN tunnel connections.
- iOS 8.0+
- macOS 10.11+
Each application is allowed to create a single VPN configuration. The
NEVPNManager class has a class method (
NEVPNManager) that provides access to a single
NEVPNManager instance. This single instance corresponds to a single VPN configuration as displayed in the VPN Settings panel in the Settings app on iOS and the Network Preferences pane in the System Preferences application in macOS.
The VPN configuration created by the
NEVPNManager instance is classified as a Personal VPN configuration. On both iOS and macOS, Non-Personal VPN configurations take precedence over Personal VPN configurations. If both a Personal VPN configuration and a Non-Personal VPN configuration are connected simultaneously, and both VPN tunnels are configured to act as the default route that network traffic takes to reach the Internet, then the Non-Personal VPN tunnel will actually be the default route to the Internet for as long as it is connected.
Use of the
NEVPNManager class requires the
com entitlement. You can get this entitlement for your app by enabling the "Personal VPN" capability for your app in Xcode.
The VPN configuration managed by
NEVPNManager is stored in the Network Extension preferences which are managed by the Network Extension framework. The VPN configuration must be explicitly loaded into memory from the Network Extension preferences before it can be used, and any changes made to the configuration must be explicitly saved to the Network Extension preferences before taking effect on the system.
Instances of this class are thread safe.