Function

LSCopyDefaultApplicationURLForContentType(_:_:_:)

Returns the application used to open a content type (UTI).

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 application is requested.

inRoleMask

Whether to return the editor or viewer for inContentType. If you don't care which, use 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 application is found, its URL is returned. If no application 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 application will be the user-specified override if appropriate or the default otherwise.

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 LSCopyApplicationForMIMEType(CFString!, LSRolesMask, UnsafeMutablePointer<Unmanaged<CFURL>?>!) -> OSStatus

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

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