I have an app that should try to save Markdown files. This is the relevant portions from my Info.plist:
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>md</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>icon.icns</string>
<key>CFBundleTypeName</key>
<string>Markdown document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>net.daringfireball.markdown</string>
</array>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>NSDocumentClass</key>
<string>MyDocument</string>
<key>NSExportableAs</key>
<array>
<string>Microsoft Word Document</string>
<string>RTF</string>
<string>HTML</string>
</array>
<key>NSExportableTypes</key>
<array>
<string>net.daringfireball.markdown</string>
<string>com.microsoft.word.doc</string>
<string>public.rtf</string>
<string>public.html</string>
</array>
</dict>
As you can see I also need the app to be able to export to doc, html and rtf.
Here is the UTExportedTypeDeclarations:
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.source</string>
</array>
<key>UTTypeDescription</key>
<string>Markdown document</string>
<key>UTTypeIdentifier</key>
<string>net.daringfireball.markdown</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>md</string>
</array>
</dict>
</dict>
Now when I save a document in my app, and then run mdls
on the file I get:
kMDItemContentType = "dyn.ah62d4rv4ge8043a"
kMDItemContentTypeTree = (
"dyn.ah62d4rv4ge8043a",
"public.data",
"public.item"
)
Furthermore my app doesn't seem to be able to open the files it previously saved and gives an error:
Error Domain=NSCocoaErrorDomain Code=256 "The autosaved document “test10.md” could not be reopened. " UserInfo=0x102210bf0 {NSLocalizedDescription=The autosaved document “test10.md” could not be reopened. }
What am I doing wrong? How can I make it recognize my UTI properly?