I use this method to check Apple Event (Automation) permission:
(我使用这种方法来检查Apple Event(Automation)权限:)
bool checkSIPforAppIdentifier(const QString &appId)
{
OSStatus status = noErr;
if (@available(macOS 10.14, *)) {
NSAppleEventDescriptor *targetAppEventDescriptor;
targetAppEventDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:appId.toNSString()];
status = AEDeterminePermissionToAutomateTarget(targetAppEventDescriptor.aeDesc, typeWildCard, typeWildCard, true);
}
return status == noErr;
}
The problem is that the execution freezes at API: AEDeterminePermissionToAutomateTarget and the user is not prompted for authorization.
(问题是执行冻结在API: AEDeterminePermissionToAutomateTarget,并且不提示用户进行授权。)
usage example:
(用法示例:)
checkSIPforAppIdentifier("com.microsoft.Word");
I have inserted necessary key in info.plist:
(我在info.plist中插入了必要的密钥:)
<key>NSAppleEventsUsageDescription</key>
<string>XXX uses this feature to do do Typography actions.</string>
My App is not sandboxed.
(我的应用未沙盒化。)
ask by mh taqia translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…