Function

LSCopyApplicationForMIMEType(_:_:_:)

Locates the preferred application 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

Locating an Application

func LSGetApplicationForItem(UnsafePointer<FSRef>!, LSRolesMask, UnsafeMutablePointer<FSRef>!, UnsafeMutablePointer<Unmanaged<CFURL>?>!) -> OSStatus

Locates the preferred application for opening an item designated by file-system reference.

Deprecated
func LSGetApplicationForInfo(OSType, OSType, CFString!, LSRolesMask, UnsafeMutablePointer<FSRef>!, UnsafeMutablePointer<Unmanaged<CFURL>?>!) -> OSStatus

Locates the preferred application for opening items with a specified file type, creator signature, filename extension, or any combination of these characteristics.

Deprecated
func LSCopyApplicationURLsForURL(CFURL, LSRolesMask) -> Unmanaged<CFArray>?

Locates all known applications suitable for opening an item designated by the specified URL.

func LSCanRefAcceptItem(UnsafePointer<FSRef>!, UnsafePointer<FSRef>!, LSRolesMask, LSAcceptanceFlags, UnsafeMutablePointer<DarwinBoolean>!) -> OSStatus

Tests whether an application can accept (open) an item designated by file-system reference.

Deprecated
func LSCopyApplicationURLsForBundleIdentifier(CFString, UnsafeMutablePointer<Unmanaged<CFError>?>?) -> Unmanaged<CFArray>?

Locates all URLs for applications that correspond to the specified bundle identifier.

func LSFindApplicationForInfo(OSType, CFString!, CFString!, UnsafeMutablePointer<FSRef>!, UnsafeMutablePointer<Unmanaged<CFURL>?>!) -> OSStatus

Locates an application with a specified creator signature, bundle ID, filename, or any combination of these characteristics.

Deprecated