1

I'm writing Swift in Xcode and using the accessibility API to get the titles of open windows through AXUIElementCopyAttributeValues.

Unfortunately the approved release version worked once. Now any change to the code causes the function to return apiDisabled. The same happens if I try to debug the app. I'm using the free developer account. (Used for signing)

How do I fix that? How can this function be used when debugging?

viraptor
  • 33,322
  • 10
  • 107
  • 191
  • Your app needs macOS accessibility permission to use accessibility. – soundflix Aug 01 '23 at 20:14
  • @soundflix yes, obviously, but that didn't really answer the question. The non-debug version was approved and worked fine once. After any change it doesn't anymore. It doesn't work either when debugging. So how do you add the accessibility permission if seems already given in the system settings – viraptor Aug 01 '23 at 21:23
  • Ok, now I understand. This question comes up from time to time. It doesn’t work without signing unfortunately. See [here](https://stackoverflow.com/a/72312500/16157878) – soundflix Aug 01 '23 at 21:32
  • @soundflix Yup, it's also using signing already (Developer key, free account) – viraptor Aug 01 '23 at 21:38

1 Answers1

0

It looks like the capability is granted to a specific version / signature / something of an app.

If you switch the way its compiled, the app needs to be actually removed from the list in the settings app (not just disabled and reenabled). On the next debug run, it will appear in the list again and can be enabled.

viraptor
  • 33,322
  • 10
  • 107
  • 191