Launch Services
Launch and open documents in other apps from your current app process.
Overview
macOS Launch Services is an API that enables a running app to open other apps or their document files, similar to the Finder or the Dock. Using Launch Services, an app can perform such tasks as:
Open (launch or activate) another app
Open a document or a URL in another app
Identify the preferred app for opening a document or URL
Register information about the kinds of document files and URLs an app can open
Obtain information for displaying a file or URL on the screen, such as its icon, display name, and kind string
Maintain and update the contents of the Recent Items menu
Launch Services eliminates apps having to query the Finder to open an app, document, or URL for them. The macOS Finder itself uses Launch Services to perform such tasks. Because the Finder performs no additional processing beyond calling Launch Services, any client using Launch Services for these purposes behaves identically to the Finder.
Topics
Locating an App
LSCopyDefaultApplicationURLForURL(_:_:_:)LSCopyDefaultApplicationURLForContentType(_:_:_:)LSCopyApplicationURLsForURL(_:_:)LSCanURLAcceptURL(_:_:_:_:_:)LSCopyApplicationURLsForBundleIdentifier(_:_:)
Opening Items
Registering an App
Working with Role Handlers
LSCopyAllRoleHandlersForContentType(_:_:)LSCopyDefaultRoleHandlerForContentType(_:_:)LSSetDefaultRoleHandlerForContentType(_:_:_:)LSSetDefaultHandlerForURLScheme(_:_:)LSRolesMask
Understanding the Quarantine Properties Dictionary
kLSQuarantineAgentBundleIdentifierKeykLSQuarantineAgentNameKeykLSQuarantineTimeStampKeykLSQuarantineTypeKeykLSQuarantineDataURLKeykLSQuarantineOriginURLKey
Identifying the Quarantine Type
kLSQuarantineTypeCalendarEventAttachmentkLSQuarantineTypeEmailAttachmentkLSQuarantineTypeInstantMessageAttachmentkLSQuarantineTypeOtherAttachmentkLSQuarantineTypeOtherDownloadkLSQuarantineTypeWebDownload
Constants
Result Codes
kLSAppInTrashErrkLSUnknownErrkLSNotAnApplicationErrkLSDataUnavailableErrkLSApplicationNotFoundErrkLSDataErrkLSLaunchInProgressErrkLSServerCommunicationErrkLSCannotSetInfoErrkLSIncompatibleSystemVersionErrkLSNoLaunchPermissionErrkLSNoExecutableErrkLSMultipleSessionsNotSupportedErr