在尝试像这样设置对我的 Firebase 存储的引用时:
let storage = FIRStorage.storage()
我看到以下错误:
uncaught exception 'NSInvalidArgumentException', reason: 'No default
Storage bucket found. Did you configure Firebase Storage properly?'
据我所知,一切都已正确设置。
- 我已经在 Firebase 上创建并链接了该应用
- 我已经生成并添加了 google plist
- 我已经用 CocoaPods 安装了库:
- pod 'Firebase/Core'
- pod 'Firebase/存储'
我已经使用 Firebase 初始化应用程序,没有任何问题:
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
}
不确定我是否遗漏了一些明显的东西,从我一直遵循的教程来看,这应该是非常简单的。无论哪种方式,任何见解都将不胜感激!提前致谢。
其他设置信息:
- Xcode 版本:8.2.1
- CocoaPods 版本:1.2.1
最佳答案
看来我过早地调用了 Firebase。我将引用调用移到了函数中:
func uploadToFirebase(data: Data) {
let ref = FIRStorage.storage().reference(withPath: "images/demoPic.jpg")
...
}
一切都进行得很顺利 - 感谢@mgtla 提供的线索!
关于iOS Swift Firebase 存储错误 "No default Storage bucket found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43485769/