AppKit does not allow directory to be selected

I have a UTI for "public.directory" and can drag-drop folders onto my app and open them. I also added this to the Info.plist to say the app supported directoryies.

But the default "Open" command seems to popup up an NSOpenPanel with folders not selectable. The "Open" button stays disabled.

How do I change this? I tried implementing "openDocument", but then it lets through any file type, not just the ones in my Info.plist. So I'd like to just use the default implementation, but need an override for the NSOpenPanel.

(IBAction)openDocument:(id)sender
{
    NSOpenPanel *panel = [NSOpenPanel openPanel];
    [panel setCanChooseFiles:YES];
    [panel setCanChooseDirectories:YES];
    
    [panel setAllowsMultipleSelection:NO];
   ...
}

Replies

Set the allowedContentTypes property, e.g.,

panel.allowedContentTypes = @[ UTTypeFolder ];