Я получаю сообщение об ошибке Значение типа 'StorageMetadata' не имеет члена 'downloadURL' после обновления моего проекта Firebase.Я не менял код в последние дни, и случайно он больше не работает.Та же ошибка появляется в 3 разных местах:
1:
// Referencing Firebase storage child with the unique identifier, and updating with the image from the picker
DatabaseManager.shared.REF_POSTS_IMAGES.child(imgUid).putData(imgData, metadata: metaData, completion: { (metadata, error) in
if error != nil {
print("Unable to upload image Firebase storage")
} else {
print("Successfully uploaded image to Firebase storage")
let downloadUrl = metadata?.downloadURL()?.absoluteString
if let url = downloadUrl {
//once the image is uploaded to firebase stoarge, its then posted to the database
self.postToFirebase(imgUrl: url)
}
}
})
2:
func uploadImages(_ data:Data,userid:String){
let metadata = StorageMetadata()
metadata.contentType = "image/jpeg"
let imagesRef = Storage.storage().reference().child("photoPosts")
let childs = imagesRef.child(userid)
var imgUrl = NSURL()
childs.putData(data, metadata: metadata) { (metadata, error) in
imgUrl = (metadata?.downloadURL())! as NSURL
self.updateURL(userid: userid, user_URL: imgUrl)
}
}
3:
func save() {
let newPostRef = Database.database().reference().child("posts").childByAutoId()
let newPostKey = newPostRef.key
// 1. save image
if let imageData = UIImageJPEGRepresentation(image, 0.5) {
let storage = Storage.storage().reference().child("images/\(newPostKey)")
storage.putData(imageData).observe(.success, handler: { (snapshot) in
self.downloadURL = snapshot.metadata?.downloadURL()?.absoluteString
let postDictionary = [
"imageDownloadURL" : self.downloadURL,
"caption" : self.caption
]
newPostRef.setValue(postDictionary)
})
}
}
Ответыиз других сообщений мне не помогают