You want:

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/#//apple_ref/occ/instm/NSWorkspace/openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:

to open a certain URL with a certain app.

and you can get a list of bundle identifiers on the system that handle the URL 
scheme with this:

https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyAllHandlersForURLScheme

you can get more info on each app using:

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/#//apple_ref/occ/instm/NSWorkspace/URLForApplicationWithBundleIdentifier:

Hope that helps,

-aaron



> On May 19, 2016, at 4:48 PM, Paul Brown <p...@paulbrown.us> wrote:
> 
> Pardon the ignorance here if there is some (I'm fairly new to OS X
> development)... If I registered my app with a special url scheme and then
> sent the mailto url to my app, doesn't that just add an unnecessary hop to
> the mix? I will already be inside my app clicking the mailto link, so I
> just need my app to handle it. By default it just uses the user's default
> mail client, but it would be nice to have a list specifically within my app
> to choose a different mail client if one is installed.
> 
> 
> On Wed, May 18, 2016 at 6:10 PM, Alex Zavatone <z...@mac.com> wrote:
> 
>> What if you preceded that mailto url with another url scheme that could be
>> mapped to your app?
>> 
>> Sent from my iPhone
>> 
>>> On May 18, 2016, at 1:04 PM, Paul Brown <p...@paulbrown.us> wrote:
>>> 
>>> I wrote a Mac app that is a little directory lookup tool. You search for
>> a name (or partial name), it pulls user info from a database and shows the
>> results in a table view. One of the columns is for Email Address. It is a
>> button that shows the address on hover, and when clicked, it opens the
>> mailto: link to compose an email to the person, like so:
>>> 
>>> NSWorkspace.sharedWorkspace().openURL(NSURL(string:String(format:"mailto:
>> %@",sender.alternateTitle))!)
>>> 
>>> Is it possible to have the user select their preferred mail application
>> that will respond to this? In my experience on iOS, there are URL schemes
>> for many apps that let a variety of apps pass data to other apps. Is this a
>> thing on OS X? The use case here is that I have my personal email account
>> configured in Mail.app, and my work email configured in Outlook 2016. It
>> would be great to have a pref pane in my app to let the user choose which
>> mail app is used.
>>> 
>>> PS - yes, I should probably not force-unwrap that NSURL. i’m getting
>> there… :-)
>>> 
>>> Thanks,
>>> Paul
>>> _______________________________________________
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>> 
>>> This email sent to z...@mac.com
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> 
>> https://lists.apple.com/mailman/options/cocoa-dev/paulgetsspam%2Bcoca-dev%40gmail.com
>> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mandelbaum%40mac.com
> 
> This email sent to mandelb...@mac.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to