I’m using the following code to send a tweet through the Twitter.app:
NSPerformService(@"Tweet", [NSPasteboard generalPasteboard]);
How can i handle the following error, to display a custom message, if the user doesn’t have the twitter.app?

I’ve tried try catch but it’s not working.
Thanks
You try obtaining
[NSApp servicesMenu]and searching it to see if a service by that name is present before invoking it.Update with example:
Update 2:
The above was for the general case and has problems with localization and when the services menu gets updated. For a specific case of a service provided by a known app, you can check if the app is present using
-[NSWorkspace absolutePathForAppBundleWithIdentifier:]to see if an app with a known bundle ID is present on the system.