我想将PhotoURL与Firebase一起存储,但是出现错误,提示Value of type 'StorageMetadata?' has no member 'downloadURL'
view.endEditing(true)
ProgressHUD.show("Waiting...", interaction: false)
if let profileImg = self.selectedImage, let imageData = profileImg.jpegData(compressionQuality: 0.1) {
let photoIdString = NSUUID().uuidString
print(photoIdString)
let storageRef = Storage.storage().reference(forURL: Config.STORAGE_ROOF_REF).child("posts").child(photoIdString)
storageRef.putData(imageData, metadata: nil, completion: { (metadata, error) in
if error != nil {
ProgressHUD.showError(error!.localizedDescription)
return
}
let photoUrl = metadata.downloadURL()?.absoluteString //Error is here
self.sendDataToDatabase(photoUrl: photoUrl!)
})
} else {
ProgressHUD.showError("Profile Image can't be empty")
}
}
在let photoUrl = metaData.downloadURL()?.absoulteString
,我收到一个Xcode错误,提示Value of type 'StorageMetadata?' has no member 'downloadURL'