4

I use this method to check Apple Event (Automation) permission:

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.

usage example:

checkSIPforAppIdentifier("com.microsoft.Word");

I have inserted necessary key in info.plist:

<key>NSAppleEventsUsageDescription</key>
<string>XXX uses this feature to do do Typography actions.</string>

My App is not sandboxed.

6
  • Did you got any solution , me too facing same issue AEDeterminePermissionToAutomateTarget waits forever to return OSStatus. Commented Nov 13, 2020 at 9:59
  • @MacDeveloper : This is probably due to a corrupted signature of the origin or destination bundle. It is better to call this method via thread.
    – mh taqia
    Commented Nov 18, 2020 at 9:17
  • Did it worked for you , I moved it to background thread but no luck Commented Nov 19, 2020 at 12:32
  • @MacDeveloper Yes it works, I get descriptor param as: AECreateDesc(typeProcessSerialNumber, &psn, sizeof(psn), &targetDesc), not using NSAppleEventDescriptor
    – mh taqia
    Commented Nov 21, 2020 at 8:48
  • did you ever find a solution? we also have two customers reporting endless freezing at this API call... Commented Dec 7, 2023 at 16:36

1 Answer 1

-3

Hardened Runtime open Apple Events enter image description here

1
  • 1
    Could you provide a bit more info on how your answer solves the problem for the OP?
    – Richard
    Commented Dec 10, 2020 at 2:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.