macOS 13.2 SwiftUI App Crashes When Using NSOpenPanel with File Filters
I'm collaborating on a project where I've searched everywhere and can't find a clear answer... I've hit a wall trying to I'm sure I'm missing something obvious here, but I'm developing a macOS application using SwiftUI and ran into an scenario where the app crashes when trying to present an `NSOpenPanel` with specified file filters... I'm using macOS 13.2, and the crash happens specifically when I set the `allowedFileTypes` property of the `NSOpenPanel`. Here is the code I have: ```swift import SwiftUI import AppKit struct ContentView: View { var body: some View { Button("Open File") { self.openFile() } } func openFile() { let panel = NSOpenPanel() panel.allowedFileTypes = ["jpg", "png", "pdf"] panel.canChooseFiles = true panel.canChooseDirectories = false panel.begin { result in if result == .OK, let url = panel.url { print("Selected file: \(url)") } } } } ``` When I run this code, I get the following behavior in the console just before the crash: ``` Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The operation couldn’t be completed. Unable to retrieve file types.' ``` I’ve checked that the file types are valid, and I'm not sure why this is happening. I've also tried using just one file type at a time and that doesn't seem to change the outcome. Has anyone else encountered this scenario, or can provide insight into what might be going wrong? Is there something I missed in setting up the `NSOpenPanel`? Thanks in advance! My development environment is Ubuntu. What am I doing wrong? I appreciate any insights! This is part of a larger service I'm building. Any suggestions would be helpful. I'm working with Swift in a Docker container on Windows 10.