saveToPreferences(completionHandler:)
Saves the DNS proxy configuration in the caller’s DNS proxy preferences.
Declaration
func saveToPreferences(completionHandler: @escaping @Sendable ((any Error)?) -> Void)func saveToPreferences() async throwsParameters
- completionHandler:
A block called when the save operation completes. If the operation fails, an error instance passed to this block describes the problem. Otherwise, the error is
nil. See Nednsproxymanagererror for the list of possible errors.
Discussion
If you alter the DNS proxy configuration that you load into the proxy manager’s properties using a call to the loadFromPreferences(completionHandler:) method, you must then call the saveToPreferences(completionHandler:) method to make the changes take effect. Saving also stores the modified configuration for the next time the proxy is started or the configuration loaded.
Trying to save preferences before loading them produces an error.
If the DNS proxy is enabled, it becomes active as a result of this call.