Я новичок в Swift. Мой вопрос в том, что я не уверен, как развернуть необязательное значение. Когда я печатаю object.objectForKey ("profile_picture"), я вижу Optional(<PFFile: 0x7fb3fd8344d0>)
.
let userQuery = PFUser.query()
//first_name is unique in Parse. So, I expect there is only 1 object I can find.
userQuery?.whereKey("first_name", equalTo: currentUser)
userQuery?.findObjectsInBackgroundWithBlock({ (objects: [PFObject]?, error: NSError?) -> Void in
if error != nil {
}
for object in objects! {
if object.objectForKey("profile_picture") != nil {
print(object.objectForKey("profile_picture"))
self.userProfilePicture.image = UIImage(data: object.objectForKey("profile_pricture")! as! NSData)
}
}
})