Any way to make NSWorkspace's showSearchResultsForQueryString work?

It fails in a sandboxed app. I found a couple suggestions. One was to add a NSAppleEventsUsageDescription pair to the Info.plist so the user would be asked to grant permission for AppleEvents. But that never happens for showSearchResultsForQueryString.

The next was to add the com.apple.security.temporary-exception.apple-events entitlement and provide com.apple.finder as the app. This DOES work, but Apple is rejecting my app because of it, even though I've said it's the only way to make showSearchResultsForQueryString work. I'm still waiting for them to tell me how to do it in a more correct way. This is obviously a bug, because an app should be able to use any NSWorkspace method without jumping through security hoops.

Has anyone else found a way to make it work and get their app on the App Store?

Thank you for your post. To receive the most efficient support for this issue, we recommend contacting Apple Developer Technical Support, who can provide code-level support for Apple frameworks, APIs, and tools. Contact them directly by filing a Technical Support Incident.

That was next on my list, if nobody had an answer for me here. I've also reported this as a bug.

Although the web page for Code-level Support Request has a blurb that says DTS will be answering questions directly in these forums between May 30 through June 17, and "will not be reviewing private support requests". So does that mean I can submit a request, but it will be ignored until June 18?

This is obviously a bug, because an app should be able to use NSWorkspace method without jumping through security hoops.

Well, not any workspace method. Some of them clearly should be restricted by the App Sandbox (recycle(_:completionHandler:) springs to mind).

However, I agree that it’d be reasonable for a sandboxed app to use showSearchResults(forQueryString:). That’s pretty innocuous. If that’s not working, I recommend that you file a bug against the App Sandbox. Oh wait…

I've also reported this as a bug.

What was that bug number?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Any way to make NSWorkspace's showSearchResultsForQueryString work?
 
 
Q