LSCopyDefaultApplicationURLForURL(_:_:_:)
Returns the app that opens an item.
Declaration
func LSCopyDefaultApplicationURLForURL(_ inURL: CFURL, _ inRoleMask: LSRolesMask, _ outError: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> Unmanaged<CFURL>?Parameters
- inURL:
The URL of the item for which the app is requested.
- inRoleMask:
Whether to return the editor or viewer for
inURL. 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 the URL is a file:// URL, the application bound to the specified file or directory's type is returned. If the URL's scheme is something else, its default scheme handler 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 inURL if it were double-clicked in the Finder. This application will be the user-specified override if appropriate or the default otherwise.