Programmatically determine if “enable access for assistive devices” is checked in Cocoa app

前端 未结 2 637
独厮守ぢ
独厮守ぢ 2021-02-08 11:08

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 t

2条回答
  •  梦如初夏
    2021-02-08 11:17

    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.

提交回复
热议问题