I have a document-based app with a custom file format, the UTIs and such set up as so:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>extension</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Icon</string>
<key>CFBundleTypeName</key>
<string>Custom Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>NSDocumentClass</key>
<string>MyDocument</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Custom Document</string>
<key>UTTypeIconFile</key>
<string>Icon</string>
<key>UTTypeIdentifier</key>
<string>com.mycompany.appname</string>
<key>UTTypeReferenceURL</key>
<string></string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>XXXX</string>
<key>public.filename-extension</key>
<array>
<string>extension</string>
</array>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array/>
Which (I assume, based on what I have read) is the correct way to do it. Except, when I run mdls on any saved files, the UTI is listed as:
kMDItemContentType = "com.apple.appname.document"
This is confusing, as I have literally copied and pasted entries from plists of example apps like, TextEdit, iSpend, and Sketch, all to no avail.
It is especially important that saved documents have the correct UTI because they need a custom QuickLook generator, which relies on the correct UTI.
Any help is greatly appreciated. Thank you in advance.