LaunchServices functionality removed for Sandboxed apps

Number:rdar://28559176 Date Originated:30-Sep-2016 00:34 AM
Status:Open Resolved:
Product:macOS Product Version:10.12
Classification:Serious Bug Reproducible:Always
As far as I can tell, new restrictions have been placed on sandboxed apps in 10.12 that prevent such apps from using a variety of LaunchServices functions (or their NSWorkspace abstractions) that would reveal the path on disk of a specific other application.

I can imagine reasons why this may have been intentionally changed, but it leaves some existing sandboxed apps (including my own sandboxed betas of MarsEdit) in a pickle, particularly when they have established reasons for looking up specific apps by bundle identifier.

MarsEdit maintains a list of temporary exceptions for sending Apple Events, because of its historic ability to integrate with other editors. For example a user can "Edit in BBEdit" and through an AppleEvent-based dance, the app is targeted and opened.

In 10.12, MarsEdit's efforts to locate the app fail. MarsEdit uses NSWorkspace to request the url of the app, but the issue is exemplified at a lower level by the return of nil by pertinent LaunchServices functions.

It seems that if an app has already asked for a temporary entitlement to send Apple Events to a specific bundle identifier, then the app should also be granted the right to look up that bundle identifier's LaunchServices information including its URL/path.

Steps to Reproduce:
1. Arrange for BBEdit to be on the computer.
2. Open attached TestingSandbox.xcodeproj.
3. Build and run

Expected Results:
The path to BBEdit should be displayd in the console.

Actual Results:
nil is printed to the console, reflecting the nil return value from:

NSWorkspace.shared().urlForApplication(withBundleIdentifier: "com.barebones.bbedit")

10.12 (16A323) 



'' was successfully uploaded.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!