检索 Parse.com 中存储的 PFFile 时遇到问题
let user = PFUser.currentUser()
let userImageFile = user["profileImage"] as PFFile
userImageFile.getDataInBackgroundWithBlock {
(imageData: NSData!, error: NSError!) -> Void in
if error == nil {
if imageData != nil{
let image = UIImage(data:imageData)
self.profileImage.image = image
}
}
}
错误从第二行开始。 列“profileImage”存在,但可以为空。
有人可以帮助我吗? 谢谢。
最佳答案
尝试:
if let userImageFile = user["profileImage"] as? PFFile {
}
关于swift - 从 Parse.com 检索 PFFile 时为 "unexpectedly found nil while unwrapping an Optional value",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25948401/