问题
i've a problem when i retrieve a PFFile stored in Parse.com
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
}
}
}
The error start at line two. Column "profileImage" exists, but it can be empty.
Someone can help me? Thank you.
回答1:
Try:
if let userImageFile = user["profileImage"] as? PFFile {
}
来源:https://stackoverflow.com/questions/25948401/unexpectedly-found-nil-while-unwrapping-an-optional-value-when-retriveing-pffi