找不到 Firebase 框架

Firebase framework not found

我一直在尝试将我的项目迁移到 cocoapods。

我觉得我快到了,但我被困在了:

ld: framework not found Firebase for architecture x86_64 error: linker command failed with exit code 1 (use -v to see invocation)

我正在尝试使用我的 "app.xcworkspace" 进行编译,项目如下所示:

另外:

我试过启动其他项目并且 firebase 在那里工作,所以这个项目设置有问题...知道吗?

我的播客文件如下所示:

# Uncomment this line to define a global platform for your project
# platform :ios, ‘8.0’

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

  # Pods for Parti

    pod 'Firebase'
    pod 'Firebase/Storage'
    pod 'Firebase/Auth'
    pod 'Firebase/Database'

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

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

end

可能需要补充一点,当 xcode 尝试 "Link /Users/myname/Library/Developer/Xcode/DerivedData/Parti-gsdsljzobcnqjkgutfpjasgrsfck/Build/Products/Debug-iphonesimulator/Parti.app/Parti"

时会发生错误

我知道这听起来有些牵强,但是:

  1. 清理项目。产品 -> 清洁
  2. 重启XCode(并非总是需要)
  3. 运行 pod update & pod install来自项目文件夹

更新: Podfile 应该更像是:

    use_frameworks!

    target 'Parti' do
      pod 'Firebase'
      pod 'Firebase/Storage'
      pod 'Firebase/Auth'
      pod 'Firebase/Database'
    end

    target 'PartiUITests' do
      pod 'Firebase'
      pod 'Firebase/Storage'
      pod 'Firebase/Auth'
      pod 'Firebase/Database'
    end

一些提示:

  • 确保您的 Podfile 正确(您是否忘记取消注释 use_frameworks! 行?您是否正确添加了 pod?)

  • 你忘了运行"pod install"吗?

  • 您是否尝试清理项目和构建文件夹?

确保您已在项目目标的 Header 搜索路径、框架搜索路径和库搜索路径中添加 $(inherited)。

还要确保在项目文件的 frameworks 文件夹中(不在 Pods 中,单击项目导航器中的项目名称),"libPods-YourProjectName.a" 不是红色的。如果是,删除它并重新构建。

刚找到答案。好像我有一个旧的 geofire 版本,而新版本还不能作为 Pod 使用...

Github Issue link

感谢您的回答。

添加 $PROJECT_DIR/Pods(使其递归)

到框架搜索路径

无论出于何种原因,只有这对我有帮助,也许你也是

另一种可能是您的项目名称不是 ASCII。例如,您的名字中可能有汉字。

在这种情况下,在“常规”->“框架、库和嵌入式内容”中,删除“Pods___.framework”,并在“Pods/ 下添加正确的名称" 会有帮助。