Firebase Storage Warning: downloadURL()' is deprecated: Use `StorageReference.downloadURLWithCompletion()

后端 未结 2 555
梦如初夏
梦如初夏 2020-12-10 19:07

I just updated my project to the latest version of Firebase Storage and I am now getting a warning: downloadURL() is deprecated: Use StorageReference.downloadURLWithComplet

2条回答
  •  时光说笑
    2020-12-10 20:08

    Basically not using the metadata but instead just getting the url after the success of your observe event. Since it's successful and you know it's there, you can download the URL. It's there in their docs to 'Generate a download URL'. Below, I'm assuming your StorageReference is uploadProfilePicTask.

    uploadProfilePicTask.downloadURL(completion: { (url, error) in
                        if (error == nil) {
                            if let downloadUrl = url {
                               // Make you download string
                               let downloadString = downloadUrl.absoluteString
                            }
                        } else {
                       // Do something if error
                        }
               })
    

提交回复
热议问题