bool checkAuth (string : appId)
{
OSStatus status = noErr;
if (@available(macOS 10.14, *)) {
Code Block NSAppleEventDescriptor *targetAppEventDescriptor;
targetAppEventDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:appId.toNSString()];
Code Block status = AEDeterminePermissionToAutomateTarget(targetAppEventDescriptor.aeDesc, typeWildCard, typeWildCard, true); }
return status == noErr;
}
The problem is that the execution freezes once in 100 times 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>*** uses this feature to do do Typography actions.</string>
My App is not sandboxed.
PS: this issue is not consistently reproducible , once I restart the machine it works