cocoapods 错误设置 Firebase 以响应本机

Posted

技术标签:

【中文标题】cocoapods 错误设置 Firebase 以响应本机【英文标题】:cocoapods error setting up firebase for react native 【发布时间】:2021-06-07 20:36:12 【问题描述】:

我一直在尝试为我最近在 Macbook air m1 上的 react native 项目设置 firebase。根据此处https://rnfirebase.io/ 的 react native firebase 官方文档这样做时,我遇到了一些问题。

    第一个是当我尝试将 if ([FIRApp defaultApp] == nil) [FIRApp configure]; 放入我的 Appdelegate.m 时,它给出了我的错误 undeclared identifier 'FIRApp'(我的主要问题)。我查看了这个错误,发现我需要更新 pod,这就是我的第二个问题开始的地方

    当我尝试更新 pod(我尝试了几种方法)时,它在终端上显示了我的以下错误

    LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle,
    

    0x0009): 缺少兼容的拱门 /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:6:in rescue in <top (required)>' /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:3:in ' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in <top (required)>' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in ' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:440:in download_typhoeus_impl_async' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:372:in download_and_save_with_retries_async' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:365:in download_file_async' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:338:in download_file' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:284:in ensure_versions_file_loaded' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:208:in search' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/source/aggregate.rb:83:in block in search' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/source/aggregate.rb:83:in select' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/source/aggregate.rb:83:in search' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:416:in create_set_from_sources' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:385:in find_cached_set' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:360:in specifications_for_dependency' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:165:in search_for' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:274:in block in sort_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:267:in each' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:267:in sort_by' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:267:in sort_dependencies' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in block in sort_dependencies' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in with_no_such_dependency_error_handling' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in sort_dependencies' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:754:in push_state_for_requirements' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:746:in require_nested_dependencies_for' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:729:in activate_new_spec' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:686:in attempt_to_activate' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in process_topmost_state' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in resolve' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in resolve' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:94:in resolve' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1074:in block in resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1072:in resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:124:in analyze' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in analyze' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in block in resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in install!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in run' /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in <top (required)>' /usr/local/bin/pod:23:in load' /usr/local/bin/pod:23:in `' ``` ―――模板结束 ―――――――――――――――――――――――――――――――――――――――――――――――― ――――――――――――――

    [!] 哦不,发生了错误。

    搜索与您类似的现有 GitHub 问题: https://github.com/CocoaPods/CocoaPods/search?q=dlopen%28%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle%2C+0x0009%29%3A+missing+compatible+arch+in+%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle+-+%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle&type=Issues

    如果不存在,请使用上面显示的模板创建票证, 上:https://github.com/CocoaPods/CocoaPods/issues/new

    请务必先阅读贡献指南,了解有关如何 正确提交票证: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

    不要忘记匿名化任何私人数据!

    寻找关于cocoapods/cocoapods的相关问题...

    CocoaPods 与 Apple DTK (Apple Silicon) https://github.com/CocoaPods/CocoaPods/issues/9907 [open] [88] 的兼容性 cmets] 4天前

    在颤振中运行项目时出错https://github.com/CocoaPods/CocoaPods/issues/10456 [关闭] [1 评论] 2 周前

    在 Ionic 5 macbook M1 Big sur https://github.com/CocoaPods/CocoaPods/issues/10411 上“更新 Firebase”时出错 [关闭] [6 cmets] 一周前

    还有 5 个: https://github.com/cocoapods/cocoapods/search?q=dlopen%28%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle%2C%200x0009%29%3A%20missing%20compatible%20arch%20in%20%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle%20-%20%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle&type=Issues&utf8=✓

我可以说问题可能出在 m1 芯片上,因为我正在使用新的 mac 用苹果硅,但不知道如何让它工作,我的主要 目标是使用firebase auth运行反应本机应用程序,即 仅当我设置遇到上述问题的 firebase 时才有可能, 如果有人可以在这方面帮助我,我将不胜感激, 提前致谢

【问题讨论】:

看看你的问题 #2:***.com/questions/64901180/… 【参考方案1】:

试试这个

sudo gem install ffi
sudo gem install cocoapods

然后进入Application文件夹 -> 右键点击Terminal App -> Get Info

勾选Open with Rosetta选项。 立即构建项目。

【讨论】:

以上是关于cocoapods 错误设置 Firebase 以响应本机的主要内容,如果未能解决你的问题,请参考以下文章

我更新了 Firebase 的 cocoapods,我的应用现在显示错误消息

使用 Cocoapods 添加到项目时出现 Firebase 错误

关于 Cocoapods 和 Firebase/Messaging 的 Unity iOS 构建错误

Firebase CocoaPods 出现重复符号链接器错误

pod 安装时出现 Flutter 错误:CocoaPods 找不到 pod“Firebase/CoreOnly”的兼容版本

在IOS中安装firebase cocoapods时的未知参数-swift