4

I was looking through the docs to find how to allow dropping on the dock icon. From what I've seen, it is recommended that you use LSItemContentTypes, as CFBundleTypeOSTypes is deprecated. However, I can not get LSItemContentTypes to work, only with CFBundleTypeOSTypes being ** will it accept the drops.

How can I do this in a non-deprecated way?

Thanks, Nick

Nick Paulson
  • 111
  • 1
  • 5

1 Answers1

6

Here's what I used in my app's Info.plist to get it to work:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>SomeName</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>None</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.mp3</string>
        </array>
    </dict>
</array>

Take a look in the Documentation to see what each key does exactly.

CFBundleTypeName and CFBundleTypeRole are required.

LSItemContentTypes is an array of UTIs. To get the UTI of a file, just type this in the Terminal:

mdls -name kMDItemContentType /path/to/file

Don't forget to adjust CFBundleTypeRole and LSHandlerRank to meet your needs.

inket
  • 1,641
  • 16
  • 21