Contents

LSCopyApplicationForMIMEType(_:_:_:)

Locates the preferred app for opening items with a specified MIME type.

Declaration

func LSCopyApplicationForMIMEType(_ inMIMEType: CFString!, _ inRoleMask: LSRolesMask, _ outAppURL: UnsafeMutablePointer<Unmanaged<CFURL>?>!) -> OSStatus

Parameters

  • inMIMEType:

    A Core Foundation string object specifying the MIME type to consider; see the CFString Reference in the Core Foundation Reference Documentation for a description of the CFStringRef data type. Comparison of MIME types is case-insensitive.

  • inRolesMask:

    A bit mask specifying the application’s desired role or roles with respect to items with the specified MIME type; see Lsrolesmask for a description of this mask. If the role is unimportant, pass kLSRolesAll.

  • outAppURL:

    A pointer to a Core Foundation URL reference that, on return, will identify the preferred application for items with the specified MIME type; see the CFURL Reference in the Core Foundation Reference Documentation for a description of the CFURLRef data type. You are responsible for releasing the URL reference object.

Return Value

A result code; see Result Codes. If no application suitable for opening items with the specified MIME type is found in the Launch Services database, the function will return the result code kLSApplicationNotFoundErr.

Discussion

Thread-safe since Mac OS version 10.2.

See Also

Deprecated Functions