简体   繁体   English

Xcode 错误:缺少必需的模块“Firebase”

[英]Xcode error: Missing required module 'Firebase'

The problem:问题:

I have a dynamic framework, which uses Firebase added by cocoapods.我有一个动态框架,它使用由 cocoapods 添加的Firebase And I also have the App, which uses this dynamic framework.我也有应用程序,它使用这个动态框架。 But when I try to build the project I got error Missing required module Firebase .但是当我尝试构建项目时出现错误Missing required module Firebase

I tried the following:我尝试了以下方法:

  • remove derived data + clean删除派生数据 + 清理
  • re-install pods重新安装豆荚
  • add 'Import paths' to the build settings (in this case I got error 'Library not loaded' in runtime)将“导入路径”添加到构建设置(在这种情况下,我在运行时收到错误“库未加载”)

My podfile:我的播客文件:

target 'Project' do    
  ...
end
target 'Framework' do    
  pod 'Firebase/Core'
  pod 'Firebase/Auth'
end

The Framework is added to Embedded binaries and Linked Frameworks and Libraries .Framework被添加到Embedded binariesLinked Frameworks and Libraries

For anyone still having this issue, doing this solved it for me.对于仍然有此问题的任何人,这样做为我解决了这个问题。 Add this to your test target build settings.将此添加到您的测试目标构建设置中。

HEADER_SEARCH_PATHS = "${SRCROOT}/Pods/Firebase/CoreOnly/Sources"

Full discussion can be found on firebase GitHub issues.可以在 firebase GitHub 问题上找到完整的讨论。

you can find HEADER_SEARCH_PATHS in Test Target > Build Settings > Search Paths > Header Search paths.您可以在 Test Target > Build Settings > Search Paths > Header Search paths 中找到 HEADER_SEARCH_PATHS。

Just incase you cant find HEADER_SEARCH_PATHS in Build Settings, click the ALL button to show all settings.以防万一您在构建设置中找不到 HEADER_SEARCH_PATHS,请单击“全部”按钮以显示所有设置。

Add the following to your test target:将以下内容添加到您的测试目标:

HEADER_SEARCH_PATHS = "${PODS_ROOT}/Firebase/CoreOnly/Sources"

That's in test target > Build Settings > Header Search Paths .这是在test target > Build Settings > Header Search Paths

After adding test target, running:添加测试目标后,运行:

pod install

and add to:并添加到:

HEADER_SEARCH_PATHS = $(inherited)

fixed for me.为我固定。

On Framework Search Path pod put all pod projects path automatically.在框架搜索路径 pod 上自动放置所有 pod 项目路径。

Of course, to podfile added this after last pod name:当然,podfile 在最后一个 pod 名称之后添加了这个:

target 'TestTargetName' do
  inherit! :search_paths
end

Nothing did help to me until没有什么对我有帮助,直到

target 'TestTargetName' do
  
    pod 'Firebase/Storage'
  
end

I'm not sure what firebase does so I can't run tests (tests do not depend on firebase at all)我不确定 firebase 的作用,所以我无法运行测试(测试根本不依赖于 firebase)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM