Dropping Files onto Dock Icon in Cocoa

If you’ve set up your Info.plist’s CFBundleDocumentTypes array properly (either ‘LSItemContentTypes’ or ‘CFBundleTypeExtensions’), then you just need to set up an NSApplication delegate and implement the delegate method, application:openFile:.

If you’re expecting multiple files to be dropped at once, implement application:openFiles:.

For promised files (NSFilesPromisePboardType/kPasteboardTypeFileURLPromise) see Dropping promised files on to application icon in Dock.

Leave a Comment