【问题标题】:Getting started with Firebase, iOS and SwiftFirebase、iOS 和 Swift 入门
【发布时间】:2016-05-19 04:55:52
【问题描述】:

也许这是一个 n00b 问题,但我还是要问它。我按照说明通过 CocoaPods 将 Firebase 添加到 Swift 应用程序。一切似乎都运行良好。这是我的 Podfile:

# 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 时,它会因为找不到类而无法构建。

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

【问题讨论】:

    标签: ios swift firebase cocoapods


    【解决方案1】:

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

    尝试运行

    pod update Firebase
    

    您现在应该拥有 Firebase 3.2.0

    【讨论】:

    • 这就是解决方案。有人向 Firebase 团队提到过这个吗?
    【解决方案2】:

    我认为你的 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 而不是项目

    【讨论】:

    • 那没有做到。我也在使用工作区文件。我不明白这一点。我过去用过 CocoaPods 没问题。
    • 有没有可能是你没有安装3.2.0版本?我现在也有同样的问题,可可豆荚无法获取最新版本的 firebase。
    • 这正是问题所在。正如下面提到的@Vugario(我首先看到了他的回答)pod update Firebase 将获取 v3.2.0,之后它就可以正常工作了。
    猜你喜欢
    • 2017-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-19
    • 2021-12-31
    • 1970-01-01
    • 2012-08-11
    相关资源
    最近更新 更多