6

Recently upgrade to macOS Sierra version 10.12, Xcode version 8.2.1

The following code works on OS Sierra but with a warning message. It works on the previous OS El Capitan 10.11 without warning message.

Anyone can advise how to get rip of this warning message?

warning: <NSRemoteView: 0x618000123200> determined it was necessary to configure <NSVBOpenPanel: 0x102e816d0> to support remote view vibrancy

my code is below:

@IBAction func btnChooseFile(_ sender: Any)
    {
        let dialog = NSOpenPanel()
        dialog.title                   = "Choose a project file"
        dialog.showsResizeIndicator    = true
        dialog.showsHiddenFiles        = false
        dialog.canChooseDirectories    = false
        dialog.canCreateDirectories    = false
        dialog.allowsMultipleSelection = false
        dialog.allowedFileTypes        = ["txt"]

        if (dialog.runModal() == NSModalResponseOK) {
            let result = dialog.url // Pathname of the file
            if (result != nil) {
                let path = result!.path
                txtProject.stringValue = path
            }else{
                // Display error message
            }
        } else {
            return
        }
    }
Cœur
  • 37,241
  • 25
  • 195
  • 267
David Evony
  • 273
  • 3
  • 15
  • I'm having the same problem with a project created in Xcode 9 targeting macOS 10.12; projects created with Xcode 8 and compiled with Xcode 9 do not have the same problem under 10.12. (May I also point out that your code sets a lot of properties to their default values; the only setting you need are the title and the allowedFileTypes) – green_knight Jun 22 '17 at 15:43
  • 2
    Ah. Found it. NSVBOpenPanel is the special class connected to sandboxed apps; so unless you turn sandboxing off, it seems you have to live with this problem. (Insights gained from https://stackoverflow.com/questions/37119631/swift-os-x-sandboxing-treat-nsvbopenpanel-as-a-nsopenpanel-because-i-n) – green_knight Jun 22 '17 at 15:53
  • That's annoying, 'cause there's another bug that means you have to turn Sandboxing ON or it complains about missing iCloud support! – Ash Jan 10 '18 at 09:30

0 Answers0