Filetypes UTI Identifier confusion

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:

[quote]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.[/quote]

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

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

@Beatrix Willius — 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.

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

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

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

[quote] CFBundleTypeExtensions

vdb

CFBundleTypeIconFile
DB.icns
CFBundleTypeName
Database
CFBundleTypeOSTypes

MaxD

CFBundleTypeRole
Editor
LSItemContentTypes

com.mothsoftware.vdb
[/quote]

Isn’t there a UTExportedTypeDeclarations or UTImportedTypeDeclarations key?

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

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

Sorry, my bad. Yes:

[quote] UTTypeIconFile
DB.icns
UTTypeIdentifier
com.mothsoftware.vdb
UTTypeTagSpecification

com.apple.ostype

MaxD

public.filename-extension

vdb

[/quote]

@Beatrix Willius — It misses

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

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

I need to ask “What means ‘Conforms to’, what to enter in that field, please?”

@Detlef Kahner — 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”

Thanks, that description is very helpful. :slight_smile: