【问题标题】:Unable to install Firebase into my Xcode project via cocoapods无法通过 cocoapods 将 Firebase 安装到我的 Xcode 项目中
【发布时间】:2016-12-29 14:26:37
【问题描述】:

我正在尝试通过 Cocoapods 1.1.1 将 Firebase 导入我的 Xcode 文件。我的 pod 文件看起来像这样。

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

target 'Firebase Login' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Firebase Login

pod 'Firebase', '~> 3.11'

  target 'Firebase LoginTests' do
    inherit! :search_paths
    pod 'Firebase'
  end

  target 'Firebase LoginUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

我也试过了。

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

target 'Firebase Login' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Firebase Login

  target 'Firebase LoginTests' do
    inherit! :search_paths
    pod 'Firebase'
  end

  target 'Firebase LoginUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

之后,我在终端中输入了 pod install ,这就是我得到的。

Analyzing dependencies
[!] Unable to find a specification for `FirebaseAnalytics (= 3.6.0)` depended upon by `Firebase/Core`

这是我做错了什么还是 Firebase 本身的错误?如果是我,如果有人能帮我解决这个问题,我将不胜感激。

【问题讨论】:

    标签: ios xcode firebase cocoapods


    【解决方案1】:

    您应该在 target 'Firebase LoginTests' do 之前添加这些 pod 否则,您只会将它们包含在您的测试目标中。

    你的 podfiel 应该是这样的

    # Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'
    
    target 'AppName' do
      # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for AppName
      pod 'Firebase'
      pod 'Firebase/Auth'
      pod 'Firebase/Database'
    
      target 'AppName' do
        inherit! :search_paths
        # Pods for testing
      end
    
      target 'AppName' do
        inherit! :search_paths
        # Pods for testing
      end
    
    end
    

    【讨论】:

    • 不幸的是,如果你错过了,这就是我在我的第一段代码中所做的......我也尝试添加 Firebase/Auth 和 Firebase/Database 但它仍然给我这个“[!]无法找到 FirebaseDatabase (= 3.1.1) 依赖于 Firebase/Database 的规范“您还发现了其他错误吗?
    • 删除您的 Podfile.lock 文件和 Pods 文件夹并在您修复 podfile 时召回 pod update
    • 我没有 Podfile.lock 文件,因为终端由于某种原因找不到我的 pod 的规范。我也尝试过更新,但显然 1.1.1 是可用的最新 Cocoapods...
    • 没问题,当你成功运行一次 pod update 或 pod install 时,它会被创建。你可以尝试使用我附加的 pod 文件替换 appname
    猜你喜欢
    • 1970-01-01
    • 2023-03-30
    • 2017-05-25
    • 1970-01-01
    • 2017-07-26
    • 1970-01-01
    • 2016-06-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多