gpt4 book ai didi

macos - macOS 10.15 Catalina的“安全性”系统偏好设置中的隐私功能 "Input Monitoring"背后是哪个API?

转载 作者:行者123 更新时间:2023-12-03 16:25:28 27 4
gpt4 key购买 nike

在macOS 10.15 Catalina中,安全性系统偏好设置中有一个名为输入监视的新部分。

它说:

Allow the apps below to monitor input from your keyboard even while using other apps.



我想知道背后是哪个API才能使应用程序进入本节。

我知道 AXIsProcessTrustedWithOptions(),它将在“输入监视”上方的“辅助功能”部分添加一个应用程序。然后,我可以使用 NSEvent.addGlobalMonitorForEvents(matching: .keyDown, handler: self.keyDown(event:))观看其他应用程序的按键操作。但是,输入监视有什么用呢?

似乎将应用程序手动添加到Input Monitoring不允许您使用 NSEvent.addGlobalMonitorForEvents(...)

在更新到Catalina之后,将Steam之类的应用程序添加到该部分中,因此必须有一些内容告诉系统将其放置在其中。

enter image description here

最佳答案

@Nick Moore是正确的。此API仅从10.15开始可用。
IOHIDRequestAccess()的请求有两种类型,几乎没有关于它的文档:-( https://developer.apple.com/documentation/iokit/3181574-iohidrequestaccess?language=objc

if #available(macOS 10.15, *) {
// below requests "Input Monitoring"
IOHIDRequestAccess(kIOHIDRequestTypeListenEvent)
// below requests "Accessibility"
IOHIDRequestAccess(kIOHIDRequestTypePostEvent)
}

关于macos - macOS 10.15 Catalina的“安全性”系统偏好设置中的隐私功能 "Input Monitoring"背后是哪个API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58670785/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com