Not authorised to send Apple Events to Finder from helper bundle

I'm having issues with executing AppleScript from the application helper bundle, which is contained in my main application bundle.

I have a simple helper application bundle which only loads my script located in helpers' bundle Resources using NSAppleScript API and executes it. Script is really simple, it basically just deletes some other application bundle. I've tested the script as standalone and everything works fine. When I run the helper bundle everything falls apart. I'm getting -1743 error (Not authorised to send Apple Events to Finder). My helper bundle is not sandboxed, has enabled apple events in the entitlements file and I've added NSAppleEventsUsageDescription key to the plist. If I run this from Xcode it works, same if I execute the binary contained in the bundle from command line.

Any ideas what might be causing the issue?
Is this “helper bundle” an actual bundle? Specifically, when you load the helper bundle to the code end up running inside your app’s main process?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
In reality the hierarchy is more complicated than this. However my helper bundle is an actual bundle which is called from parent bundle. This lies deeper in my main app bundle hierarchy but is executed separately from the main application.

I've already found a solution. I needed to propagate NSAppleEventsUsageDescription key up the bundle hierarchy Info.plists to the very top (main application bundle).
Not authorised to send Apple Events to Finder from helper bundle
 
 
Q