Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
377 views
in Technique[技术] by (71.8m points)

macos - AEDeterminePermissionToAutomateTarget的授权等待无限时间(Authorization by AEDeterminePermissionToAutomateTarget waits infinit time)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...