shreddish
shreddish

Reputation: 1774

Swift getting image from Parse.com and setting image with it

Trying to get an image from parse and set a uiimage with it but keep getting this error. Running Xcode 7 and swift 2.0

Cannot invoke 'getDataInBackgroundWithBlock' with an argument list of type '(imageData:NSData,error:NSError.Type,()->())'

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)")
        }
    }

Upvotes: 0

Views: 81

Answers (1)

Russell
Russell

Reputation: 3089

Change

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

To

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

Upvotes: 1

Related Questions