本文介绍了StorageMetadata"没有成员"downloadURL"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的代码,但是当我更新代码和吊舱时出现以下错误:
i use below code but when i update codes and pods get bellow error:
static func uploadVideoToFirebaseStorage(videoUrl: URL, onSuccess: @escaping (_ videoUrl: String) -> Void) {
let videoIdString = NSUUID().uuidString
let storageRef = Storage.storage().reference(forURL: Config.STORAGE_ROOF_REF).child("posts").child(videoIdString)
storageRef.putFile(from: videoUrl, metadata: nil) { (metadata, error) in
if error != nil {
ProgressHUD.showError(error!.localizedDescription)
return
}
if let videoUrl = metadata?.downloadURL()?.absoluteString {
onSuccess(videoUrl)
}
}
}
我该如何解决?
更新:
推荐答案
新版本删除了StorageMetadata上的downloadURLs属性.使用StorageReference.downloadURL(completion :)获得当前的下载URL.
As new release removed downloadURLs property on StorageMetadata. Use StorageReference.downloadURL(completion:) to obtain a current download URL.
// reference of the file that's you want to download
let ref = storageRef.child("simpleImage.jpg")
// get the download URL
ref.downloadURL { url, error in
if let error = error {
} else {
// Here you can get the download URL for 'simpleImage.jpg'
}
}
您可以从此处获取参考: https://firebase.google .com/support/release-notes/ios#5.0.0
You can get reference from here :https://firebase.google.com/support/release-notes/ios#5.0.0
这篇关于StorageMetadata"没有成员"downloadURL"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!