我已经创建了一个var userImages = [PFFile](),并通过用户查询和self.userImages.append(user["imageFile"] as! PFFile)从解析中添加了相应的用户图像。这可以很好地工作。但是,当我尝试通过
userImages.getDataInBackGroundWithBlock{ (data, error) -> Void in ...
我收到以下错误:**'[(PFFile)]' does not have a member named 'getDataInBackGroundWithBlock'**
为什么这不起作用,这个问题的解决方案是什么?
谢谢你的帮助!!


发布于 2015-06-08 13:37:50
您正在尝试调用数组中的getDataInBackGroundWithBlock尝试使用“
userImages.last?.getDataInBackGroundWithBlock{...}或者,您可以将其保存在一个变量中,并使用新的PFFIle来检索图像
let userImage = user["imageFile"] as! PFFile
userImage.getDataInBackGroundWithBlock{...}或者使用以下命令直接访问:
(user["imageFile"] as! PFFile).getDataInBackGroundWithBlock{...}角色流程是:
self.userImages.append(user["imageFile"] as! PFFile) //This is just a reference to download the image
userImages.last?.getDataInBackgroundWithBlock {
(imageData: NSData?, error: NSError?) -> Void in
if error == nil {
if let imageData = imageData {
let image = UIImage(data:imageData) // this is the final image
}
}
}https://stackoverflow.com/questions/30701825
复制相似问题