After upgrading target to MacOS 12, cannot open or import any files

I recently updated my sandboxed application to the MacOS 12 target. Among deprecation, there is the allowedFileTypes method for NSOpenPanel/NSSavePanel, replaced with allowedContentTypes. I updated my document opening and importing methods to reflect this change. For example, to import a CSV or JSON file, I coded:

myPanel.allowedContentTypes = [NSArray arrayWithObjects:UTTypeJSON, UTTypeCommaSeparatedText, UTTypeTabSeparatedText, [UTType typeWithIdentifier: @"org.openxmlformats.spreadsheetml.sheet"], nil] ;

All these UTTypes are described in the "Imported Type UTIs" section of the app's Info.plist.

Unfortunately, it is impossible to select any of Json, Csv or Xlsx file in the NSOpenPanel since I made these changes to be in line with MacOS12 requirements. Worse, I cannot open my own file format with its own UTI (described in Info.plist too)! The only way to open/import is to set myPanel.allowOtherFileTypes to TRUE, and to remove any code referring to allowedContentTypes.

What is quite strange is that exporting works correctly after updating. My spotlight plugin works also (for my file format)… Something I missed? Help welcome as my app became useless since I made these changes, and I use it every day for my work (and improving it before launching it on the Appstore)

UPDATE: In fact, to the contrary of what I wrote, I can't even read files setting myPanel.allowOtherFileTypes to TRUE

Corrected. I had forgotten to update the - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url method to manage UT types instead of UTI strings

After upgrading target to MacOS 12, cannot open or import any files
 
 
Q