iOS Swift Firebase存储错误“未找到默认存储桶"; [英] iOS Swift Firebase Storage error "No default Storage bucket found"

查看:76
本文介绍了iOS Swift Firebase存储错误“未找到默认存储桶";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试设置对Firebase存储的引用时,如下所示:

While trying to set a reference to my Firebase Storage like so:

let storage = FIRStorage.storage()

我看到以下错误:

uncaught exception 'NSInvalidArgumentException', reason: 'No default 
Storage bucket found. Did you configure Firebase Storage properly?'

据我所知,一切都已正确设置.

As far as I know everything is setup properly.

  • 我已经在Firebase上创建并链接了该应用程序
  • 我已经生成并添加了Google plist
  • 我已经用CocoaPods安装了库:
    • pod"Firebase/Core"
    • pod"Firebase/存储"
    • I have created and linked the app on Firebase
    • I've generated and added the google plist
    • I have installed the libraries with CocoaPods:
      • pod 'Firebase/Core'
      • pod 'Firebase/Storage'

      我已经使用Firebase初始化了应用,没有任何问题:

      I've initialized the app with Firebase with no issues:

      import Firebase
      import UIKit
      
      
      class AppDelegate: UIResponder, UIApplicationDelegate {
      
          var window: UIWindow?
      
      
          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
              // Override point for customization after application launch.
      
              // Use Firebase library to configure APIs
              FIRApp.configure()
      
              return true
          }
      

      不确定我是否遗漏了一些明显的东西,在我一直遵循的教程中,这应该很简单.无论哪种方式,任何见解都将不胜感激!预先感谢.

      Not sure if there is something obvious that I am missing, from the tutorials I've been following this should be pretty straight forward. Either way any insight would be much appreciated! Thanks in advance.

      其他设置信息:

      • Xcode版本:8.2.1
      • CocoaPods版本:1.2.1

      推荐答案

      似乎我在调用Firebase太早了.我将参考调用移到了函数中:

      It seems I was calling on Firebase too soon. I moved the reference call into the function:

      func uploadToFirebase(data: Data) {
          let ref = FIRStorage.storage().reference(withPath: "images/demoPic.jpg")
         ...
      }
      

      一切都进行得很顺利-感谢@mgtla的提示!

      And everything has been working smoothly - thanks for the clue @mgtla !

      这篇关于iOS Swift Firebase存储错误“未找到默认存储桶";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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