I have created a document based app that needs to open xml text files with a particular extension. When I created the project in Xcode using the NSDocument template I specified the extension I wanted and everything was working fine.
Following the Apple guide on how to build document based apps I went to edit the Info.plist file to add the details of the UTI that were missing before. Suddenly my app stopped opening files with the extension I want and in fact stopped opening any file. Also when I try to save a file the save dialog doesn't suggest any extension any more.
When I save a file and run the command mdls
from the terminal I get
kMDItemContentTypeTree = (
"public.data",
"public.item"
)
instead of public.xml
I set for the UTI in the Info.plist.
It seems that my app stopped recognising the informations stored in the Info.plist. Is there anything I have to connect in Xcode in order to have this working?
Here is the relevant parts of my Info.plist file:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>xmds</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>AppIcon</string>
<key>CFBundleTypeName</key>
<string>XMDS Script</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>xmds</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.dedalus.degs</string>
</array>
<key>NSDocumentClass</key>
<string>Document</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeDescription</key>
<string>XMDS Script</string>
<key>UTTypeIconFile</key>
<string>AppIcon</string>
<key>UTTypeIdentifier</key>
<string>com.dedalus.degs</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<array>
<string>xmds</string>
</array>
<key>public.filename-extension</key>
<array>
<string>xmds</string>
</array>
</dict>
</dict>
</array>