On running the following code:
let pid = getAppPid()
let AXApp = AXUIElementCreateApplication(pid)
var children: CFTypeRef?
let returnVal = AXUIElementCopyAttributeValue(AXApp,
kAXChildrenAttribute as CFString, &children)
AXApp
gets created successfully
However
children
isnil
returnVal
isAXError.cannotComplete
("A fundamental error has occurred, such as a failure to allocate memory during processing.")
I've seen code on stack overflow and elsewhere using exactly the same method as I am.
What am I missing.
I am using Xcode 9/Swift 4 on MacOS High Sierra.
EDIT:
I should add that Xcode has accessibility permissions, and I am able to successfully do other stuff that requires accessibility permission like CGEvent.tapCreate()
to monitor global keyboard events etc.
App Sandbox
key toNO
in the.entitlements
file. I this the best way? I couldn't find a key to just request entitlement for accessibility, while preserving the rest of the sandbox compliance features. Do you know if some thing like that exists? Thanks. – Blakey