I have made one sandboxed app which calls NSWorkspace's showSearchResultsForQueryString but this method doesn't work.
I guess this error can be associated with entitlement key, but i could't find answer.
How can I implement entitlement key for this?
That method won't work for a sandboxed app. It sends an Apple event to the Finder.
Have a look at this link in the sandbox design guide:
Determine Whether Your App Is Suitable for Sandboxing
and you'll see the following text:
With App Sandbox, you can receive Apple events and respond to Apple events, but you cannot send Apple events to arbitrary apps.
This method can not be used in sandboxed application. Because this method should be fixed to run within sandboxed application in future.
来源:https://stackoverflow.com/questions/11805374/how-do-i-write-entitlements-to-use-nsworkspaces-showsearchresultsforquerystring