Firebase 入门,iOS 和 Swift

Getting started with Firebase, iOS and Swift

也许这是一个 n00b 问题,但我还是要问。我按照说明通过 CocoaPods 将 Firebase 添加到 Swift 应用程序。一切似乎都很好。这是我的播客文件:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'FirebaseDemo2' do
    # Comment this line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!

    # Pods for FirebaseDemo2
    pod 'Firebase'
end

当尝试将 Firebase 模块导入 AppDelegate 时,起初 Xcode 抱怨找不到它,但项目构建得很好。但是,当尝试添加 FIRApp 时,它无法构建,因为它找不到 class。

Podfile 与 .xcodeproj 在同一目录中,我在 Xcode 中打开 .xcworkspace 文件。这真的让我很困惑。有人可以看到我做错了什么吗? CocoaPods 是否配置错误?

我认为你的 Podfile 应该是这样的:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!

target 'FirebaseDemo2' do
     pod 'Firebase'
end

确保打开 Xcodeworkspace 而不是项目

我有同样的问题,它安装了 2.5.1 但你需要 3.2.0

尝试运行

pod update Firebase

您现在应该拥有 Firebase 3.2.0