Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting default application for URL scheme



On May 14, 2008, at 3:06 PM, Nick Zitzmann wrote:

On May 14, 2008, at 1:16 PM, Matthew Gertner wrote:

I'd like to set the application that should be run when a URL with a
given scheme is opened. The only way I've found to do this is
_LSSetDefaultSchemeHandlerURL, but I'd rather not go with an
undocumented API if it can be avoided. Is there a Cocoa API or
something for this that I haven't been able to find? Or would I be
better off using the Cocoa APIs to modify the launch services database
directly?


There is no Cocoa API. The only supported way of doing this is to use LSSetDefaultHandlerForURLScheme(), which requires Tiger or later. Prior to Tiger, you had to use Internet Config to do that.

Do you really need to set the default handler? Generally, Mac applications merely advertise that they are capable of handling a given URL scheme and it's left to the user to pick the default handler. To merely advertise the capability, see the documentation of the CFBundleURLTypes key of the Info.plist file:


http://developer.apple.com/documentation/MacOSX/Conceptual/ BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/ 20001431-102207

http://developer.apple.com/documentation/Carbon/Conceptual/ LaunchServicesConcepts/LSCConcepts/chapter_2_section_4.html#// apple_ref/doc/uid/TP30000999-CH202-CIHFEEAD

Cheers,
Ken
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Setting default application for URL scheme (From: "Matthew Gertner" <email@hidden>)
 >Re: Setting default application for URL scheme (From: Nick Zitzmann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.