Custom UTIs based on com.apple.package don't always work


Steve Mills
 

I have a file type all set up in my target's Document Types and Exported UTIs as so:

<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>livery</string>
</array>
<key>CFBundleTypeName</key>
<string>Livery</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).livery</string>
</array>
<key>LSTypeIsPackage</key>
<integer>1</integer>
</dict>
</array>

<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.apple.package</string>
</array>
<key>UTTypeDescription</key>
<string>Livery</string>
<key>UTTypeIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).livery</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>livery</string>
</array>
</dict>
</dict>
</array>

It always work on the Macs where I've done most of the development work, which started on 10.10 and is now 10.13. When I sync and run it on mac 10.14 Mac, the files never work because [url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:nil] says it's a public.folder instead of my declared UTI. I can make it work by copying the app into /Applications and running it from there. From then it will work when running from Xcode. But as soon as I delete the app from /Applictions and then run from Xcode again, it goes back to thinking it's public.folder.

Why doesn't this work like it should? And by that I mean that if one is developing an app that has custom UTIs, they should *work* during development. I could just leave a copy in /Applications, but I shouldn't have to.

--
Steve Mills
Drummer, Mac geek

Join cocoa@apple-dev.groups.io to automatically receive all group messages.