gpt4 book ai didi

swift - 按用户名划分的 Firebase 存储镜像

转载 作者:行者123 更新时间:2023-11-30 12:36:21 26 4
gpt4 key购买 nike

我已按用户名将用户个人资料图片保存在 Firebase Storage 中。

如何检索用户的图像?

我不断收到相同的错误消息:

unexpectedly found nil while unwrapping an Optional value

这是我的代码:

let filePath = "\("profileImage/\(self.userNameText.text!)")"
self.storageRef.child(filePath).data(withMaxSize: INT64_MAX, completion: { (data, error) in
let profileImage = UIImage(data: data!)
self.profileImage.image = profileImage
})

最佳答案

在解包可选值时意外发现 nil 意味着您正在尝试使用返回 nil 的值,因此该值不存在。

您在哪一行收到此错误?

关于swift - 按用户名划分的 Firebase 存储镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42819144/

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