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"

BTW, the review team wouldn't let me use the entitlement, even though it's the only way I've found to workaround the bug, so I disabled the feature to open the Spotlight window for now. Hopefully this will be fixed toot sweet so I can enable it again.

FYI, it’s best to reply in a reply rather than in the comments. I’m much less likely to see the latter. See Quinn’s Top Ten DevForums Tips for this and other tips.

FB13818056

Thanks for filing that. It’s likely that it’ll be closed a dup of a much older bug (r. 12032862), one that remains unresolved )-:

Share and Enjoy

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

Ah, thanks for that bit of info. I hadn't seen the comment feature before and figured it was a new way of replying to a specific reply. Odd.

So I'll add it to my ever-growing pile of unresolved bugs. Neato.

Any way to make NSWorkspace's showSearchResultsForQueryString work?
 
 
Q