Swift从Parse.com获取图像并使用它设置图像

时间:2015-09-25 19:49:17

标签: swift parse-platform

尝试从解析中获取图像并使用它设置uiimage,但不断收到此错误。运行Xcode 7和swift 2.0

无法使用类型为'(imageData:NSData,错误:NSError.Type,() - >())'

的参数列表调用'getDataInBackgroundWithBlock'
let query: PFQuery = PFQuery(className: "Items")
    query.whereKey("ItemOwner", equalTo: "Shreddish")

    // 3
    query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
        if error == nil {
            print("Successfully retrieved: \(objects)")
            for object in objects! {
                print(object)
                let imageFile: PFFile = object["ItemMainImage"] as! PFFile
                var image = imageFile.getData()

                imageFile.getDataInBackgroundWithBlock(imageData: NSData, error: NSError) {


                }
            }
        } else {
            print("Error: \(error) \(error!.userInfo)")
        }
    }

1 个答案:

答案 0 :(得分:1)

更改

imageFile.getDataInBackgroundWithBlock(imageData: NSData, error: NSError) {
    ...
}

imageFile.getDataInBackgroundWithBlock {
    (imageData: NSData?, error: NSError?) -> Void in
    ...
}