收到此错误:
“类型为'StorageMetadata'的值没有成员'downloadURL'
在代码中,我知道Firebase 5.0.0
中有一种用于downloadURL的新方法,但是我不知道如何在我的代码中实现它...
if let imgData = UIImageJPEGRepresentation(img, 0.2) {
let imgUid = NSUUID().uuidString
let metadata = StorageMetadata()
metadata.contentType = "image/jpeg"
Storage.storage().reference().child(imgUid).putData(imgData, metadata: metadata) { (metadata, error) in
if error != nil {
print("did not upload img")
} else {
print("uploaded")
let downloadURL = metadata?<error_appears>.downloadURL()?.absoluteString
if let url = downloadURL {
self.setUser(img: url)
}
}
}
}