Registry /
auth-security / pyobjc-framework-localauthenticationembeddedui
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LAAuthenticationView
✓ from LocalAuthenticationEmbeddedUI import LAAuthenticationView
Primary view for embedded authentication UI.
LAAuthenticationViewDelegate
✓ from LocalAuthenticationEmbeddedUI import LAAuthenticationViewDelegate
Protocol for handling authentication view results.
LAContext
✓ from LocalAuthentication import LAContext
Used to evaluate authentication policies, typically alongside LAAuthenticationView.
This quickstart demonstrates how to instantiate and use `LAAuthenticationView` for embedded biometric authentication within a basic macOS Cocoa application. It sets up an `NSApplication`, a window, and integrates the `LAAuthenticationView` with a custom delegate to handle authentication results. Note that `LAAuthenticationView` requires a running macOS application context to be visible and functional. The `LAContext` object is imported from the `LocalAuthentication` framework, which works in conjunction with the UI component. The exact enum values for `LAAuthenticationResult` might need to be verified against Apple's latest documentation.
import objc
from AppKit import NSApplication, NSWindow, NSView, NSRect, NSButton, NSAppDelegate, NSApp
from Foundation import NSObject, NSSelectorFromString, NSLog
from LocalAuthenticationEmbeddedUI import LAAuthenticationView, LAAuthenticationViewDelegate
from LocalAuthentication import LAContext, LAPolicy, LAError
class AuthenticationDelegate(NSObject, LAAuthenticationViewDelegate):
def authenticationView_didCompleteWithResult_error_(self, view, result, error):
if error:
NSLog(f"Authentication failed with error: {error.localizedDescription()}")
if error.code() == LAError.UserCancel: # LAError.UserCancel is part of LAError, not LAError.Code.UserCancel
NSLog("User cancelled authentication.")
elif result:
if result == 1: # Assuming LAAuthenticationResult.Success is 1. Check Apple docs for exact enum values.
NSLog("Authentication successful!")
else:
NSLog("Authentication completed with unknown result.")
else:
NSLog("Authentication completed, but no result or error.")
class AppDelegate(NSObject):
def applicationDidFinishLaunching_(self, notification):
# Create a window
self.window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(
NSRect((200, 300), (400, 200)),
(1 << 0 | 1 << 1 | 1 << 3 | 1 << 8), # Titled, Closable, Miniaturizable, Resizable
2, # NSBackingStoreBuffered
False
)
self.window.setTitle_("PyObjC LAEmbeddedUI Example")
self.window.makeKeyAndOrderFront_(None)
# Create a content view
content_view = NSView.alloc().init().autorelease()
self.window.setContentView_(content_view)
# Create LAAuthenticationView
self.auth_view = LAAuthenticationView.alloc().initWithFrame_(NSRect((50, 50), (300, 100)))
content_view.addSubview_(self.auth_view)
# Set delegate and context
self.delegate = AuthenticationDelegate.alloc().init()
self.auth_view.setDelegate_(self.delegate)
# Create LAContext (from LocalAuthentication framework)
self.la_context = LAContext.alloc().init()
self.auth_view.setContext_(self.la_context)
# Start authentication (LAAuthenticationView will start when added to view hierarchy with context)
# It might also need an explicit call like evaluatePolicy_localizedReason_reply_ from LAContext
# but for embedded UI, setting the context and delegate is often enough to trigger its display.
NSLog("LAAuthenticationView added. Awaiting user interaction.")
if __name__ == '__main__':
app = NSApplication.sharedApplication()
delegate = AppDelegate.alloc().init()
NSApp().setDelegate_(delegate)
app.run()
Debug
Known issues
breakingPyObjC v12.0 dropped support for Python 3.9. Users on Python 3.9 or earlier should use PyObjC v11.x or upgrade their Python version.fixUpgrade Python to 3.10 or later, or downgrade `pyobjc-framework-localauthenticationembeddedui` to a compatible version (e.g., `pip install 'pyobjc-framework-localauthenticationembeddedui<12.0'`).
affects: >=12.0
breakingPyObjC v11.0 dropped support for Python 3.8. Users on Python 3.8 or earlier should use PyObjC v10.x or upgrade their Python version.fixUpgrade Python to 3.9 or later, or downgrade `pyobjc-framework-localauthenticationembeddedui` to a compatible version (e.g., `pip install 'pyobjc-framework-localauthenticationembeddedui<11.0'`).
affects: >=11.0
breakingPyObjC v11.1 changed the reference counting behavior for initializer methods to align with `clang`'s Automatic Reference Counting (ARC) documentation. This might alter how references to `self` are handled during object initialization.fixReview code that relies on specific reference counting behavior during object initialization. Adapt to the new ARC-compliant model, which correctly models `init` family methods stealing and returning a new reference.
affects: >=11.1
gotchaPyObjC framework wrappers, including LocalAuthenticationEmbeddedUI, generally do not include their own documentation. Developers must refer to Apple's official documentation for the `LocalAuthenticationEmbeddedUI` framework to understand API usage, class methods, and protocols.fixConsult Apple's developer documentation for `LocalAuthenticationEmbeddedUI` and related frameworks (like `LocalAuthentication`) when working with these Python bindings.
affects: All
gotchaAs of PyObjC v10.3, the library does not support the experimental free-threading feature introduced in Python 3.13. Running PyObjC with free-threading enabled may lead to undefined behavior or crashes.fixIf using Python 3.13, disable experimental free-threading (if applicable) or use PyObjC in a standard single-interpreter thread mode.
affects: >=10.3 (with Python 3.13+)
gotchaIn v10.1, the behavior of `os.fspath()` for Cocoa URLs (NSURL, CFURLRef) referring to local filesystem paths was changed. It now works correctly, while `TypeError` is raised for other URLs.fixIf previously relying on `os.fspath()` with Cocoa URLs, ensure your code correctly handles the new behavior, where it now works for local paths but raises `TypeError` for non-local URLs.
affects: >=10.1
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredThis is a framework wrapper built on top of the PyObjC core bridge.