All Application URLs for MIME type

216 Views Asked by At

Besides LSCopyDefaultApplicationURLForURL there exists LSCopyApplicationURLsForURL to get all applications, not just the default one.

If you just want to get default applications for a MIME type, there is LSCopyDefaultApplicationURLForContentType, but it doesn't seem to have an equivalent to get all supported applications.

How can I get all supported applications for a MIME type, without having an actual file on disk?

1

There are 1 best solutions below

0
James Bucanek On BEST ANSWER

The LSCopyAllRoleHandlersForContentType will return a list of application bundle IDs that are registered to handle a particular content type (using a UTI).

The logical difference between this function and LSCopyApplicationURLsForURL is that the list can be filtered to just those applications that handle said content in a particular way (display-only, edit, etc.). If you want all of the applications, pass kLSRolesAll.

To obtain the actual application URL(s), call LSCopyApplicationURLsForBundleIdentifier with one of the returned app IDs.