How to Prompt for Accessibility Features in a MACos App (From the Appdelegate)

How to prompt for accessibility features in a macOS app (from the AppDelegate)?

I realized this is an Xcode bug instead. This is caused if the SwiftUI preview provider is run concurrently with the actual build, this causes some confusion with the accessibility permissions with macOS.

The application works as expected after the derived data directory is cleaned. You can do that with

rm -rf ~/Library/Developer/Xcode/DerivedData

Persist accessibility permissions between builds in xcode 13

Figures I would solve this right after I post it.

The App needs to be signed with a certificate following this process to keep continuity between builds.

If your Apple ID is already hooked up to XCode and you have a developer account, I went to the "Signing and Capabilities" section in the App Targets section and updated "Signing Certificate" to "Development".

How to access accessibility settings in MacOSX Cocoa app using swift?

The kAXTrustedCheckOptionPrompt type is Unmanaged<CFString> so you need to access to the retained value as show below

let options : NSDictionary = [kAXTrustedCheckOptionPrompt.takeRetainedValue() as NSString: true]
let accessibilityEnabled = AXIsProcessTrustedWithOptions(options)


Related Topics



Leave a reply



Submit