Filetypes UTI Identifier confusion

  1. 6 weeks ago

    Beatrix W

    Jan 8 Pre-Release Testers Europe (Germany)

    One of my filetypes - the most important one - doesn't want its files to be doubleclicked. I did the needful for checking that the filetype really doesn't work: removed all older versions of my app, redid the launch service database, restarted the computer.

    After a lot of staring I can see that I set an UTI identifier for the misbehaving filetype. If I remove the UTI identifier the filetype goes back to working fine.

    The docs say:

    UTI Identifier (macOS-only)
    Required for Mac apps that want to use a file type. The Uniform Type Identifier is a unique identifier used by macOS to identify a file. Following the reverse-DNS format beginning with com.companyName.myTypeName is a simple way to ensure uniqueness. An example of a UTI might be: com.example.contactdata.

    So why would the UTI identifier mess up my filetype? Or is there - as usual - something that I missed on this topic?

  2. Roger C

    Jan 8 Lewis Center, OH

    What was the UTI that you were using?
    Have you set the file type to be exported by your app?

  3. @Beatrix W — If your file type is a new one, you need to set the UTI as well as the "Conforms to" UTI and select the "Exported" RadioButton. This declares your UTI to the system.

    [url=https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1This is[/url] a list of system-declared UTIs.

    If you plan to use a UTI declared by another application, copy the declared UTI and "Conforms to" from that app but select "Imported" radio button. It means that your app is not re-declaring the UTI but using an existing one.

    In any case, you can check in the Info.plist file generated for your app that it contains the UTI declaration.

  4. Beatrix W

    Jan 9 Pre-Release Testers Europe (Germany)

    @Stephane Mons: yes, this sounds like what I did. But as soon as there is an UTI declared the filetype doesn't work anymore.

  5. @Beatrix W — What does the Info.plist file contain for your UTI? Especially which Role is attributed?

  6. Beatrix W

    Jan 9 Pre-Release Testers Europe (Germany)

    Role is editor. Here is the relevant part of the plist file:

    <key>CFBundleTypeExtensions</key>
    <array>
    <string>vdb</string>
    </array>
    <key>CFBundleTypeIconFile</key>
    <string>DB.icns</string>
    <key>CFBundleTypeName</key>
    <string>Database</string>
    <key>CFBundleTypeOSTypes</key>
    <array>
    <string>MaxD</string>
    </array>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>LSItemContentTypes</key>
    <array>
    <string>com.mothsoftware.vdb</string>
    </array>

  7. Isn't there a UTExportedTypeDeclarations or UTImportedTypeDeclarations key?

  8. Beatrix W

    Jan 9 Pre-Release Testers Europe (Germany)

    In Xojo I have UTI Identifier = com.mothsoftware.vdb . Which makes the LSItemContentTypes = com.mothsoftware.vdb entry.

  9. @Beatrix W — Yes but in the Info.plist file, isn't there any UTExportedTypeDeclarations or UTImportedTypeDeclarations section?

  10. Beatrix W

    Jan 9 Pre-Release Testers Europe (Germany)

    Sorry, my bad. Yes:

    <key>UTTypeIconFile</key>
    <string>DB.icns</string>
    <key>UTTypeIdentifier</key>
    <string>com.mothsoftware.vdb</string>
    <key>UTTypeTagSpecification</key>
    <dict>
    <key>com.apple.ostype</key>
    <array>
    <string>MaxD</string>
    </array>
    <key>public.filename-extension</key>
    <array>
    <string>vdb</string>
    </array>
    </dict>

  11. @Beatrix W — It misses

    <key>UTTypeConformsTo</key>
    <array>
    <string>public.data</string>
    </array>

    Have you declared "Conforms to": public.data in Xojo?

  12. I need to ask "What means 'Conforms to', what to enter in that field, please?"

  13. @Detlef K — The "Conforms to" is essentially the "super class" of a UTI. For example, each UTI describing a different image format (jpeg, gif, png...) will declare "conforms to" as "public.image" which is the base type for images, itself conforming to "public.data". Ultimately, each UTI must inherit from a "public.*" UTI. See here for the basic inheritance tree.

    See also the system-declared UTI

    For an existing UTI, you must provide the "conforms to" which it declared (see the above list of system-declared UTI).

    For a UTI of your own, you should set "conforms to" to the most sensible "super class". If it is text-based, you should pick something from the "public.text" hierarchy. If you can't find something sensible, use the default "public.data"

  14. 5 weeks ago

    Thanks, that description is very helpful. :)

or Sign Up to reply!