i use below code but when i update codes and pods get bellow error:
StorageMetadata' has no member 'downloadURL'
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)
}
}
}
how i can fix this?
update:
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'
}
}
You can get reference from here :https://firebase.google.com/support/release-notes/ios#5.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With