presentationContextProvider

var presentationContextProvider: ERROR CLASS: Symbol not found for ASAuthorizationControllerPresentationContextProvidingProtocol??

Optional presentation context provider for the authorization controller.

On macOS, ASAuthorizationController requires a presentation context provider that returns the window (ASPresentationAnchor / NSWindow) in which to display the passkey sheet. Without this, macOS will fail with error code 1004 ("No host window provided").

On iOS, this is not required — the system automatically presents the sheet.

Set this property before calling any registration or authentication methods on macOS. The provider holds a strong reference to the context provider.

Example from Swift (macOS):

class WindowProvider: NSObject, ASAuthorizationControllerPresentationContextProviding {
func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor {
return NSApplication.shared.keyWindow ?? NSWindow()
}
}
provider.presentationContextProvider = WindowProvider()