PFFile 到 UIImage swift 3?
PFFile to UIImage with swift 3?
我正在尝试使用此代码
if let userPicture = object.valueForKey("Image")! as! PFFile {
userPicture.getDataInBackgroundWithBlock({
(imageData: Data!, error: Error!) -> Void in
if (error == nil) {
let image = UIImage(data:imageData)
self.ImageArray.append(image)
}
})
}
我遇到了这个错误
Cannot convert value of type '(Data!, Error!) -> Void' to expected
argument type 'PFDataResultBlock?'
我解决了我的问题
Swift 3 :
if let userPicture = object.valueForKey("Image")! as! PFFile {
userPicture.getDataInBackground({ (imageData: Data?, error: Error?) -> Void in
let image = UIImage(data: imageData!)
if image != nil {
self.imageArray.append(image!)
}
})
}
我正在尝试使用此代码
if let userPicture = object.valueForKey("Image")! as! PFFile {
userPicture.getDataInBackgroundWithBlock({
(imageData: Data!, error: Error!) -> Void in
if (error == nil) {
let image = UIImage(data:imageData)
self.ImageArray.append(image)
}
})
}
我遇到了这个错误
Cannot convert value of type '(Data!, Error!) -> Void' to expected argument type 'PFDataResultBlock?'
我解决了我的问题
Swift 3 :
if let userPicture = object.valueForKey("Image")! as! PFFile {
userPicture.getDataInBackground({ (imageData: Data?, error: Error?) -> Void in
let image = UIImage(data: imageData!)
if image != nil {
self.imageArray.append(image!)
}
})
}