MacOs。如何在每个应用程序上请求访问系统事件?

问题描述 投票:1回答:2

我需要我的Mac Swift应用程序使用系统事件(通过Applescript)关闭用户添加到列表中的所有应用程序。我在“系统偏好设置”中看到许多在“自动化”面板中具有“系统事件”访问权限的应用(例如“ Google的备份和同步”或“ Divvy”)。我该如何请求权限?

swift cocoa applescript entitlements
2个回答
0
投票

我还想检测自动化权限并触发系统事件请求!有人知道吗?


0
投票

在Info.plist中,在源代码视图中添加键NSAppleEventsUsageDescription

<key>NSAppleEventsUsageDescription</key>
<string>$(PRODUCT_NAME) needs to control System Events</string>

或[Property List]视图的弹出菜单中的Privacy - AppleEvents Sending Usage Description

<string>值是任意描述。

此外,在启用了强化运行时的Xcode 11中,您必须选中Apple Events复选框

© www.soinside.com 2019 - 2024. All rights reserved.