Get accessibility access in SwiftUI / Xcode 12.5

Viewed 233

I want the user to grant the Universal Access permissions in System preferences for my Mac app.

  1. I expect the following code to recognize that the app has not the appropriate permissions and prompt the system pop-up "The following application wants Accessibility access" or whatever, but it just returns false:
            let options : NSDictionary = [kAXTrustedCheckOptionPrompt.takeRetainedValue() as NSString: true]
            let accessibilityEnabled = AXIsProcessTrustedWithOptions(options)

  1. I can manually grant Accessibility access to applications in System Preferences -> Security -> Accessibility, but there, of course, I don't see the app I'm developing in Xcode. How to grant such permissions to an app in development? I tried to generally give permissions to XCode but that doesn't work and AXIsProcessTrustedWithOptions keeps returning false.
0 Answers
Related