Swift 尝试导入图像时出现Metadata.framework错误

Swift 尝试导入图像时出现Metadata.framework错误,swift,image,macos,cocoa,import,Swift,Image,Macos,Cocoa,Import,在我的应用程序中导入图像后,我在Xcode的调试区域中收到以下消息: "[21950:1148196] Metadata.framework [Error]: couldn't get the client port". 我怎样才能消除这个错误 以下是我上传图片的代码: @IBAction func importButton(sender: AnyObject) { let uploadFile: NSOpenPanel = NSOpenPanel() uploadFile

在我的应用程序中导入图像后,我在Xcode的调试区域中收到以下消息:

"[21950:1148196] Metadata.framework [Error]: couldn't get the client port".
我怎样才能消除这个错误

以下是我上传图片的代码:

@IBAction func importButton(sender: AnyObject) {

    let uploadFile: NSOpenPanel = NSOpenPanel()

    uploadFile.allowsMultipleSelection = false
    uploadFile.canChooseFiles = true
    uploadFile.canChooseDirectories = false

    uploadFile.runModal()

    let chosenPicture = uploadFile.URL

        if(chosenPicture != nil) {

            let pictureImport = NSImage(contentsOfURL: chosenPicture!)
            imageWell.image = pictureImport
        }
}

我收到此错误消息是因为我禁用了Spotlight索引(因此无法访问应用程序和图像的元数据)

打开“聚光灯”后,在错误消息上自动建立索引

"Metadata.framework [Error]: couldn't get the client port"
在Xcode的调试区域消失