我已经在这个问题上工作了将近两天,现在似乎无法解决这个问题。我试图将保存的图像从Parse加载到UIImageView上。我有另一个功能,它可以为两段文本执行此操作,但是当我尝试检索图像时,它不起作用。有什么想法吗?
func showImage() {
var query = PFQuery(className: "Description")
query.orderByDescending("ceatedAt")
query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]?, error: NSError?) -> Void in
self.images = [UIImage]()
if let objects = objects {
for imageObject in objects {
let userImage = (imageObject as! PFObject)["UserPhoto"] as? PFFile
if userImage != nil {
userImage!.getDataInBackgroundWithBlock {
(imageData, error) -> Void in
if error == nil {
let image = UIImage(data: imageData!)
self.images.append(image!)
}
self.theTableView.reloadData()
}}
}
}
}
}
答案 0 :(得分:0)
请在将此行代码query.orderByDescending(“ceatedAt”)更改为query.orderByDescending(“createdAt”)后尝试。