首页 > 解决方案 > “StorageMetadata”类型的值没有成员“downloadURL”

问题描述

我刚刚将 Firebase Storage 更新到 5.0.0,它看起来metadata.downloadURL()不再被识别了。( Value of type 'StorageMetadata' has no member 'downloadURL')

虽然在查看文档后它应该仍然可用:

https://firebase.google.com/docs/reference/swift/firebasestorage/api/reference/Classes/StorageMetadata#/c:objc(cs)FIRStorageMetadata(im)downloadURL

该项目已经清理和重建。

我错过了什么吗?

标签: swiftxcodefirebaseswift4firebase-storage

解决方案


你能试一下吗

// Create a reference to the file you want to download
let starsRef = storageRef.child("images/stars.jpg")

// Fetch the download URL
starsRef.downloadURL { url, error in
  if let error = error {
    // Handle any errors
  } else {
    // Get the download URL for 'images/stars.jpg'
  }
}

推荐阅读