Contents

LSCopyDefaultApplicationURLForContentType(_:_:_:)

Returns the app that opens a content type.

Declaration

func LSCopyDefaultApplicationURLForContentType(_ inContentType: CFString, _ inRoleMask: LSRolesMask, _ outError: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> Unmanaged<CFURL>?

Parameters

  • inContentType:

    The Uniform Type Identifier (UTI) of the item for which the app is requested.

  • inRoleMask:

    Whether to return the editor or viewer for inContentType. If you don't care which, use 1450616 All.

  • outError:

    On failure, set to a Cferror describing the problem. If you are not interested in this information, pass NULL. The caller is responsible for releasing this object.

Return Value

If an acceptable app is found, its URL is returned. If no app could be found, NULL is returned and outError (if not NULL) is populated with kLSApplicationNotFoundErr. The caller is responsible for releasing this URL.

Discussion

Consults the binding tables to return the application that would be used to open a file of type inContentType if it were double-clicked in the Finder. This app will be the user-specified override if appropriate or the default otherwise.

See Also

Locating an App