最近升级到macOS Sierra版本10.12,Xcode版本8.2.1
以下代码适用于OS Sierra,但带有警告消息。它适用于之前的操作系统El Capitan 10.11而没有警告信息。
任何人都可以建议如何撕掉这条警告信息?
warning: <NSRemoteView: 0x618000123200> determined it was necessary to configure <NSVBOpenPanel: 0x102e816d0> to support remote view vibrancy
我的代码如下:
@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
}
}