【发布时间】:2017-03-26 13:30:04
【问题描述】:
我正在开发一个 iOS 项目(使用 xcode 8 和 swift 3)。我已经通过 cocoapod 安装了 firebase pod。这是我的豆荚:
target 'myApp' do
pod 'Firebase', '~> 3.9'
end
然后我打开 myApp.xcworkspace 文件,项目在 Xcode 中打开。
然后我尝试通过以下方式初始化一个 firebase 实例:
let BASE_URL = "https://myapp-35211.firebaseio.com/"
// ERROR: Cannot call value of non-function type 'module<Firebase>'
let firebase = Firebase(url: "\(BASE_URL)")
(我有import Firebase)
我正在尝试使用 firebase 数据库。
为什么会出现上述错误?
====== 更新 =======
好的,我按照步骤初始化 Firebase(在 Firebase 中添加我的项目,下载 GoogleService-Info.plist 并使用 FIRApp.configure() 等)。现在我得到这个错误:
为什么?
我的 Podfile 是这样的:
target 'myApp' do
pod 'Firebase', '~> 3.9'
end
这是否意味着此 pod 不包含 Firebase/Database ???
===== 再次更新 =====
好的,将'Firebase/Database' 添加到Podfile 解决了上述问题,但是为什么'Firebase' pod 不包含Firebase/Database?不是'Firebase' pod 的子集吗?
【问题讨论】:
-
你导入了firebase吗?
-
你在 appdelegate 中调用
FIRApp.configure()吗? -
另外,我觉得这个问题可能和这个类似:stackoverflow.com/questions/37355824/…
标签: ios swift firebase firebase-realtime-database