Custom file type is not accepted on my App Icon

In a four yeras old application (used every day), I used a custom sqlite db file extention (cdb).

I noticed recently a strange behavior: the application refuse to open a .cdb file when I drag it on the application icon.

As a test, minutes ago, I duplicated a .cdb file, changed its file extension to .sqlite and my application reacted to the drop !!!
How can it be so: .sqlite is not set in the application.

The .cdb file type UTI is public.database.

The reported Meta Data are:

kMDItemContentTypeTree = ( "com.apple.application-bundle", "com.apple.application", "public.executable", "com.apple.localizable-name-bundle", "com.apple.bundle", "public.directory", "public.item", "com.apple.package" )

Nota: I forgot how to accept a file drop on the App Icon, so, please forgive me.

See App.NewDocument event and the other one can’t remember the name.

Do you have a screenshot of the filetype or write it’s settings out perhaps.

If you want to control this, there’s three things that you need:

  1. The UTI for your file needs to be unique. Use your app identifier + .cdb, and inherited from public.database if you want other database editors to continue taking it.
  2. The file type must be marked as Exported because it’s something that your app creates. Don’t do this with just public.database or you’ll screw up other apps that take that.
  3. Make sure your app accepts this type by adding it in the macOS build target. You’ll want to set the role to Editor.

Like everyone else, I forgot many details:

the project started with Real Studio (probably a 2012 version).
the project actually runs on 2015r1.

The .cdb custom file is defined as follows:

File Type Set Name: FT_DB Display Name: Base de donnes Caritas (cdb) Object Name CaritasCDB MacType: SQL MacCreator: <empty> Extensions: .cdb UTIs: public.database Icon: filed with a custom icon

In the BUILD SETTINGS for OS X, I have (between others):
Creator Code: ecdb
File Types (Choose button) where I get a sheet window that display here (five entries)

I have the FT_DB File Type Set defined as Editor (as FT_DB.CaritasCDB). I also have a defined TEXT file (as Editor).
The .txt files are accepted if I try to drop one on my App icon. Same kind of definition.
I just tried to drop an xml file above my app icon (despite its not Editor status [certainly set to none]). It is certainly the TEXT defined FTS that is responsible for this behavior).

It may be important to note: I use one File Type Set for each defined file kind. So, as far as I can see, I have in a folder five defined File Type Sets (for DB, Folder, JSON, TXT and XML, not in this alphabetical order).
Is the appearance order of the the File Type Sets meaningful ?

I certainly had troubles with File Type Sets to do that (or I do not wanted to get troubles using a single File Type Sets with all my five defined types).

Another question: is theres a document (I do not found yet) that highlight how to set an application as drop friendly ?

We fixed a few bugs regarding UTIs and modern versions of macOS last summer (either 2016r2 or 2016r3), so it’s possible that you are running into something that was fixed since 2015r1.

I can also tell you that macOS tends to use the UTI definitions from the application with the highest version number attached… and if there are more than one on your machine, it’s usually the first one that it encountered. What I’m saying is that if you’re testing and the version number is 2.0.1.0 and you don’t increase that number in some way from build to build, you may not see the effect of your changes when you rebuild. This is a really good use of the auto increment feature of the non-release number.