---
title: "loadFromPreferences(completionHandler:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/nevpnmanager/loadfrompreferences(completionhandler:)"
---

# loadFromPreferences(completionHandler:)

Load the VPN configuration from the Network Extension preferences.

## Declaration

```swift
func loadFromPreferences(completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func loadFromPreferences() async throws
```

## Parameters

- `completionHandler`: A block that takes an doc://com.apple.documentation/documentation/Foundation/NSError object. This block will be executed on the caller’s main thread after the load operation is complete. If the configuration does not exist in the preferences or is loaded successfully, the error parameter will be nil. If an error occurred while loading the configuration, the error parameter will be set to an NSError object containing details about the error. See NEVPN Errors for a list of possible errors.

## Discussion

Discussion You must call this method at least once before calling saveToPreferencesWithCompletionHandler: for the first time after your app launches.

## See Also

### Managing VPN configurations

- [shared()](networkextension/nevpnmanager/shared().md)
- [saveToPreferences(completionHandler:)](networkextension/nevpnmanager/savetopreferences(completionhandler:).md)
- [setAuthorization(_:)](networkextension/nevpnmanager/setauthorization(_:).md)
- [removeFromPreferences(completionHandler:)](networkextension/nevpnmanager/removefrompreferences(completionhandler:).md)
