In my application, I wanted to include a QuickLook plugin that reads a non-system extension other applications also use (let's use RAR for this example). I declare the extension as an Exported UTI
in my app bundle's Info.plist like so:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.archive</string>
<string>com.rarlab.rar-archive</string>
</array>
<key>UTTypeDescription</key>
<string>Custom RAR Archive</string>
<key>UTTypeIdentifier</key>
<string>com.my-company.rarx-archive</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>rarx</string>
</array>
</dict>
</dict>
</array>
And I also appropriately import the RAR UTI:
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.archive</string>
</array>
<key>UTTypeDescription</key>
<string>RAR Archive</string>
<key>UTTypeIconFile</key>
<string>RAR</string>
<key>UTTypeIdentifier</key>
<string>com.rarlab.rar-archive</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>rar</string>
<string>rarx</string>
</array>
</dict>
</dict>
</array>
The RARX files never seem to get associated with my app after I run it, though. To check the association, I used mdls
like so:
mdls -name kMDItemContentTypeTree "/Users/Me/.../A File.rarx"
>>> kMDItemContentTypeTree = (
"com.another-company.rarx-archive",
"public.data",
"public.item",
"public.archive"
)
Why isn't my UTI (com.my-company.rarx-archive
) showing up in that list? I believe this is resulting in my Quick Look plugin not firing, as the files are associated with the com.another-company.rarx-archive
UTI. The other app on my system is what gets used instead. Running qlmanage
with debugging output bears this out.