以编程方式确定“为辅助设备启用访问”在Cocoa应用程序中检查 [英] Programmatically determine if "enable access for assistive devices" is checked in Cocoa app

查看:140
本文介绍了以编程方式确定“为辅助设备启用访问”在Cocoa应用程序中检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用NSAccessibility API的可可应用程序需要在通用访问预设窗格中选中启用辅助设备的访问权限。我看到许多应用程序弹出一个警告,如果这是禁用时,他们运行。如何以程式方式检查这是否已启用,因此我可以在我的应用程式中显示警告?

解决方案

AXAPIEnabled()

  extern Boolean AXAPIEnabled(); 

引用文档


返回是否启用辅助API。



如果辅助API当前已启用,则返回TRUE,否则为
FALSE。
$ b

如果辅助API不是
启用,或者调用进程不是可信的辅助功能
客户端,辅助应用程序将无法工作。用户可以通过在通用访问偏好设置中选中启用
访问辅助设备来启用辅助功能API。



Cocoa apps using the NSAccessibility API require "enable access for assistive devices" to be checked in the Universal Access pref pane. I've seen many apps pop a warning if this is disabled when they run. How do I programmatically check if this is enabled so I can show a warning in my app?

解决方案

I think you're looking for AXAPIEnabled().

extern Boolean AXAPIEnabled ();  

Quoting the docs:

Returns whether the accessibility API is enabled.

Returns TRUE if the accessibility API is currently enabled, otherwise FALSE.

Assistive applications will not work if the accessibility API is not enabled or if the calling process is not a trusted accessibility client. Users can enable the accessibility API by checking "Enable access for assistive devices" in Universal Access Preferences.

这篇关于以编程方式确定“为辅助设备启用访问”在Cocoa应用程序中检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆