HI! I am developing an application that should utilize ScriptingBridge.framework to interact with another process. Firstly, I created a separate test application for which I have added Apple Events entitlements via "Signing & Capabilities" section in Xcode and updated its Info.plist to have "Privacy - AppleEvents Sending Usage Description". While the test app works fine (I see an automation request popup and the process executes as expected) the main application where I want to integrate this functionality gets closed immediately after reaching the code interacting with Scripting Bridge. On its launch, I see the following error message from tccd in Console:
Prompting policy for hardened runtime; service: kTCCServiceAppleEvents requires entitlement com.apple.security.automation.apple-events but it is missing for accessing={TCCDProcess: identifier=<app bundleID>, ..., binary_path=<path to the app's binary>}
I had no such issues with the test app. Moreover, I should mention that the bundle I want to have with such functionality is stored in another bundle, both main and inner bundles aren't sandboxed, and the target app has Application is agent (UIElement)
key set in Info.plist.
Can you suggest any ideas as to why processes behave so differently despite having pretty much the same build configurations?
Sorry, writing a response during the night in a foreign language was a bad idea...
No worries. I’m horribly jet lagged, so I’m struggling to form coherent sentences myself (-:
However, the message in this popup states that Automation permission is requested by a container app
Yeah, that’s what I suspect. This is working correctly. When a process makes a request, TCC tries to find the responsible code, that is, the nearest ‘parent’ [1] of the process that the user knows about. Because your UI element app is embedded in your container app, the user never sees that app, and thus the responsible code is the container app.
Given that, I think you’re all good. Reply back here if you hit further snags.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] In quotes because I’m not talking about a parent process here. The algorithm that TCC uses to determine the responsible code is complex and evolves over time. You only have limited input into it, for example, AssociatedBundleIdentifiers
is one of its inputs.