Firebase:提供的存储桶与Swift中当前实例的存储存储桶不匹配 [英] Firebase: Provided bucket does not match the Storage bucket of the current instance in Swift

查看:69
本文介绍了Firebase:提供的存储桶与Swift中当前实例的存储存储桶不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

let storageRef = FIRStorage().reference(forURL: "gs://slugbug-....appspot.com") // dots intentional
let imageRef = storageRef.child("testImage.jpg")

但是该应用程序崩溃了,我收到以下消息:

But the app crashes and I get the following message:

由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'提供的存储区: slugbug -.... appspot.com与 当前实例:(空)'

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Provided bucket: slugbug-....appspot.com does not match the Storage bucket of the current instance: (null)'

即使我使用

let storageRef = FIRStorage().reference()

存储桶为零.

为什么?

推荐答案

我想出了解决方案:

我更改了以下代码:

let storageRef = FIRStorage().reference(forURL: "gs://slugbug-....appspot.com")

收件人:

let storageRef = FIRStorage.storage().reference(forURL: "gs://slugbug-....appspot.com")

...一个非常微妙但令人讨厌的错误

... a very subtle but annoying bug

这篇关于Firebase:提供的存储桶与Swift中当前实例的存储存储桶不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆