gpt4 book ai didi

ios - 手动获取 Firebase 数据库文件 donwloadURL - iOS 平台

转载 作者:行者123 更新时间:2023-11-29 00:44:50 24 4
gpt4 key购买 nike

我知道我是否通过 putData 方法将图像文件上传到 Firebase 数据库。作为返回,我可以从 metadata 中获取 downloadURL

但是如果我不想存储此 downloadURL 该怎么办。后来,我想下载这个图像。

问题:如果我知道图像的文件名,我可以获得这个下载网址吗?

最佳答案

如果您知道 Firebase 存储中图像的文件名(或者实际上:文件路径),则可以使用以下方式获取下载网址:

// Create a reference to the file you want to download
let starsRef = storageRef.child("images/stars.jpg")
// Fetch the download URL
starsRef.downloadURLWithCompletion { (URL, error) -> Void in
if (error != nil) {
// Handle any errors
} else {
// Get the download URL for 'images/stars.jpg'
}
}

参见 Firebase Storage documentation on downloading files我从哪里得到上面的例子。

关于ios - 手动获取 Firebase 数据库文件 donwloadURL - iOS 平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38751690/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com