Function

LSCopyAllRoleHandlersForContentType

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

Declaration

CFArrayRef LSCopyAllRoleHandlersForContentType(CFStringRef inContentType, LSRolesMask inRole);

Parameters

inContentType

The content type. The content type is a uniform type identifier (UTI).

inRole

The role. Pass kLSRolesAll if any role is acceptable. For additional possible values, see LSRolesMask.

Return Value

The application bundle identifiers for applications capable of handling the specified content type in the specified roles, or NULL if no handlers are available.

In macOS 10.15 and later, the returned array is sorted so that the first element contains the bundle identifier of the best available application for opening the content type. Prior to macOS 10.15, the order of elements in the array was undefined.

Discussion

This function returns all of the application bundle identifiers that are capable of handling the specified content type in the specified roles.

The CFBundleDocumentTypes key in an application’s Info.plist can be used to set an application’s content handling capabilities. The LSItemContentTypes key is particularly useful because it supports the use of UTIs in document claims.

Version Notes

Thread-safe since macOS 10.4.

See Also

Working With Role Handlers

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
LSSetDefaultHandlerForURLScheme

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