WARNING: Trying to access an unrecognized member: NSWorkspace.shared
cruinh opened this issue · comments
I have your package installed and imported into my project, and I'm trying to use it to open a folder in Finder from a new SwiftUI app. I tried hooking it up to a menu item like so:
The menu and button appears just fine, but when I click it this appears in the console:
WARNING: Trying to access an unrecognized member: NSWorkspace.shared
This is on macOS 11.1 with Xcode 12.3
The correct name for ObjC is sharedWorkspace
, so that's what you should use here. Make sure to always check the method signature for ObjC.
Oh that did the trick. Thank you!
I did also have to adjust the arguments I passed to actually get it to open, but this worked.
Dynamic.NSWorkspace.sharedWorkspace.selectFile("/Users/", inFileViewerRootedAtPath: "/Users/")
Glad it works!