ios - Firebase:提供的存储桶与 Swift 中当前实例的存储桶不匹配

标签 ios swift firebase firebase-storage

我有以下代码:

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

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

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()

桶为零。

为什么?

最佳答案

您缺少 .storage()

检查你的线路。应该是:

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

希望对你有帮助

关于ios - Firebase:提供的存储桶与 Swift 中当前实例的存储桶不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44253124/

相关文章:

ios - 旋转设备时布局崩溃

iOS 13 和 UINavigationBarDelegate::shouldPop()

ios - 如何在 Swift 中将文件写入位于 Apple 文件应用程序的文件夹中

java - 如何在 Firebase 中使用推送通知关闭 Activity ?

ios - Swift Firebase : "_GSDK_NSClassFromString", 引用自:

javascript - 无法使用非对象作为目标或处理程序创建代理

ios - 当您关闭并重新打开应用程序时,如何在 iOS 上保留 Firebase 连接?

ios - 将 Microsoft Team Foundation Server 集成到 iOS 应用程序中的推荐方法是什么

ios - UIBezierPath 路径的交集

ios - 使用 NSUserDefaults Swift 存储数据