Function

LSSetDefaultHandlerForURLScheme

Sets the user’s preferred default handler for the specified URL scheme.

Declaration

OSStatus LSSetDefaultHandlerForURLScheme(CFStringRef inURLScheme, CFStringRef inHandlerBundleID);

Parameters

inURLScheme

The URL scheme for which the handler is to be set.

inHandlerBundleID

The application bundle identifier that is to be set as the handler for the URL scheme specified by inURLScheme.

Return Value

A result code; see Result Codes.

Discussion

Call LSCopyDefaultHandlerForURLScheme to get the current setting of the user’s preferred default handler for a specified content type.

URL handling capability is determined according to the value of the CFBundleURLTypes key in an application’s Info.plist. For information on the CFBundleURLTypes key, see the section “CFBundleURLTypes” in macOS Runtime Configuration Guidelines.

Version-Notes

Thread-safe since OS X v10.4.

See Also

Working With Role Handlers

LSCopyAllRoleHandlersForContentType

Locates an array of application bundle identifiers for applications capable of handling a specified content type with the specified roles.

LSCopyDefaultRoleHandlerForContentType

Returns the application bundle identifier of the user’s preferred default handler for the specified content type with the specified role.

LSSetDefaultRoleHandlerForContentType

Sets the user’s preferred default handler for the specified content type in the specified roles.

LSGetHandlerOptionsForContentType

Gets the handler options for the specified content type.

Deprecated
LSSetHandlerOptionsForContentType

Sets the handler option for the specified content type.

Deprecated
LSCopyAllHandlersForURLScheme

Locates application bundle identifiers for applications capable of handling the specified URL scheme.

Deprecated
LSCopyDefaultHandlerForURLScheme

Returns the application bundle identifier of the user’s preferred default handler for the specified URL scheme.

Deprecated