<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NEDNSProxyManager/removeFromPreferences(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NEDNSProxyManager(im)removeFromPreferencesWithCompletionHandler:"
  },
  "title" : "removeFromPreferences(completionHandler:)"
}
-->

# removeFromPreferences(completionHandler:)

Removes the DNS proxy configuration from the caller’s DNS proxy preferences.

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

## Parameters

`completionHandler`

A block called when the remove operation completes. If the operation fails, an error instance passed to this block describes the problem. Otherwise, the error is `nil`. See [`NEDNSProxyManagerError`](/documentation/NetworkExtension/NEDNSProxyManagerError) for the list of possible errors.

## Discussion

If you use a device without an installed configuration profile during development, your app can create the DNS proxy configuration from scratch. You first call the [`loadFromPreferences(completionHandler:)`](/documentation/NetworkExtension/NEDNSProxyManager/loadFromPreferences(completionHandler:)) method to retrieve the empty configuration. You then make updates and call the [`saveToPreferences(completionHandler:)`](/documentation/NetworkExtension/NEDNSProxyManager/saveToPreferences(completionHandler:)) method to store them. To remove the configuration, call the [`removeFromPreferences(completionHandler:)`](/documentation/NetworkExtension/NEDNSProxyManager/removeFromPreferences(completionHandler:)) method. This allows you to restore the device to a clean, unconfigured state.

In a production environment, however, a configuration profile placed in the system by an external process typically provides the baseline DNS proxy configuration. Your app can modify this configuration at runtime using the same load-modify-save steps, but cannot remove the configuration entirely. An attempt to remove the configuration when a configuration profile is present on the device results in a [`NEDNSProxyManagerError.configurationCannotBeRemoved`](/documentation/NetworkExtension/NEDNSProxyManagerError/configurationCannotBeRemoved) error.

If the DNS proxy is enabled, it becomes disabled as a result of this call.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)