How do I give my app “assistive access privileges” once “Enable Access for Assistive Devices” has been checked?

寵の児 提交于 2020-01-13 06:04:13

问题


I have an app that uses a (perfectly user-benevolent) system-wide keyboard hook for accessibility purposes.

When the app starts up, I check if the "Enable Access for Assistive Devices" setting is checked, as asked by someone else here: Programmatically determine if "enable access for assistive devices" is checked in Cocoa app

My problem is that, even after Enabling Access via the checkbox, the app continues to run without those privileges. How do I give the (currently running) app the privileges and get the keyboard hook working? Do I need to restart the app?


回答1:


Looking through the link you posted,

I asked the Accessibility engineer again, and apparently you have to re-exec or re-launch the now-trusted application for the new state to take effect.

I would present the user with a notification or message that the application has to restart to enable assistive privileges, then restart it.



来源:https://stackoverflow.com/questions/9132845/how-do-i-give-my-app-assistive-access-privileges-once-enable-access-for-assis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!