Hi,
I'm developing a sandboxed macOS application intended for distribution through the Mac App Store.
During TestFlight review, a build was rejected because it included the com.apple.security.temporary-exception.apple-events entitlement for interacting with Finder and Terminal.
The application only needs limited, user-initiated contextual information, such as the currently selected file or folder in Finder, or the working directory in Terminal.
I'm trying to understand the recommended, App Store-compliant approach rather than relying on temporary sandbox exceptions.
My questions are:
Is there an officially supported way for a sandboxed app to retrieve Finder's current selection when triggered by a global keyboard shortcut, without Apple Events?
Is accessing Terminal's current working directory supported under App Sandbox with explicit user consent?
Are Finder Sync extensions, Accessibility APIs, macOS Services, or other frameworks recommended for these use cases?
Are temporary Apple Events exceptions generally unsuitable for Mac App Store distribution, even when the interaction is explicitly initiated by the user?
I've already removed the entitlement from the current build, but I'd appreciate clarification on the recommended architecture for this type of integration.
Any guidance from Apple engineers or developers with similar experience would be appreciated.
Thanks!
Most of your questions are about App Review policy. I don’t work for App Review and can’t give you definitive answers about their policy. If you need that, I suggest you contact them directly.
I do have some technology-focused answers though:
Are Finder Sync extensions … recommended for these use cases?
No. Finder Sync extensions are intended to be use to manage syncing the file system with a cloud-based file store. If you try to use them for other tasks, you inevitably run into problem. If you review the various threads with the Finder Sync tag, you’ll see a bunch of cases where developers who’ve not followed this advice have come a cropper.
Are … Accessibility APIs … recommended for these use cases?
The docs specifically call out that accessibility APIs aren’t supported by App Sandbox.
Are … macOS Services … recommended for these use cases?
That’s definitely something you should investigate. Critically, the user can associated a keyboard shortcut with a service, which also gets you out of the hotkey business.
My general take on this is that you should make your app scriptable, either via AppleScript or by Shortcuts. Once you do that, the user can use the system’s scripting facilities to invoke your app from the right context. That puts the user in charge, which in turns means that you run into less security roadblocks.
For example, if you support an Apple event to act on a specific directory, then the user can:
- Create a script that gets the current working directory from Terminal and invokes that Apple event on your app.
- And run that from the Script menu, or from whatever other automation app they use (for example, I might invoke it via Keyboard Maestro).
This has a bunch of advantages:
- The user can customise this to work with their preferred terminal app.
- The Apple event gives you the current working directory path…
- And, critically, it includes a security-scoped URL that grants you access to that directory.
The downside is that it’s a bit of a faff for users to set up, but you can assist them with their in your documentation. And if you’re target market is folks using Terminal, it’s a reasonable bet that your typical user a) can achieve this goal, and b) would appreciate this level of customisation.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"