Associating a file extension with my application

I know how to manually associate a specific file or universal extension with a specific OS X application. (Get information> Open with> Other ...)

I know how in OS X to drag a file with an extension onto an "unsupported" application. (While holding down the command option while dragging the application)

As the author of an OS X application, how can I indicate that my application knows how to open a specific file extension?

  • I want my users not to need to use the drag and drop command option.
  • I want my users to see my application listed in the Recommended Applications section instead of All Applications when choosing an application to open my extensions.
  • Ideally, I want my users to see files with my (unique, not already connected) extension that magically displays the correct icon and opens with my application as soon as .app dragged into the Applications folder.

I saw "MacOSX - associate file extension with application - programmatically" , but I do not want users to run the installer or shell script after installation.

+2
file-extension macos
source share
1 answer

To declare its support for file types, your application must include CFBundleDocumentTypes in its Info.plist

Then we realize

- application: openFile: (for dragging a single file)
or
- application: openFiles: (drag and drop multiple files)

See how to populate the Information Properties List section in the Document-Based Programming Guide for Mac

+4
source share

All Articles