Phrogz
Phrogz

Reputation: 303136

Associating a file extension with my application

I know how to manually associate a specific file or generic extension with a particular OS X application. (Get Info > Open with > Other…)

I know how, in OS X, to drag-and-drop a file with an extension onto an 'unsupported' application. (Hold down command-option when dragging over the application)

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


I have seen "MacOSX - File extension associate with application - Programatically", but I do not want to have to have users run an installer or shell script after installation.

Upvotes: 5

Views: 3328

Answers (1)

Parag Bafna
Parag Bafna

Reputation: 22930

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

Then implement

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

Have a look at Complete the Information Property List section in Document-Based App Programming Guide for Mac

Upvotes: 6

Related Questions