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

时间:2016-08-09 14:12:37

标签: 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.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
        }
}

1 个答案:

答案 0 :(得分:1)

我收到此错误消息,因为我已禁用Spotlight索引(因此无法访问应用程序'以及图像元数据)。

将Spotlight自动索引打开后,显示错误消息

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

消失。