使用@react-native-firebase/firestore时iOS出现BoringSSL-GRPC.modulemap缺失错误
iOS端@react-native-firebase/firestore模块映射缺失问题解决方案
以下是针对该问题的可行解决步骤,按顺序尝试:
清理CocoaPods环境重新安装
- 删除iOS目录下的
Podfile.lock和Pods文件夹:rm ios/Podfile.lock rm -rf ios/Pods - 清空CocoaPods本地缓存:
pod cache clean --all - 回到iOS目录重新执行安装:
cd ios && pod install
- 删除iOS目录下的
锁定依赖版本避免冲突
在ios/Podfile中手动指定BoringSSL-GRPC和gRPC-Core的稳定版本,添加以下代码到Podfile中:pod 'BoringSSL-GRPC', '~> 0.0.23' pod 'gRPC-Core', '~> 1.54.0'保存后重新执行
pod install检查Xcode头文件搜索路径配置
- 打开Xcode,选中项目Target,进入
Build Settings页面 - 搜索
Header Search Paths,确保包含$(inherited) - 添加路径
$(PODS_ROOT)/Headers/Private/openssl_grpc,并设置为recursive模式
- 打开Xcode,选中项目Target,进入
切换CocoaPods版本
1.9.0版本可能存在兼容性问题,尝试升级到稳定版本:sudo gem install cocoapods -v 1.15.2升级完成后重新执行
pod install调整静态链接配置
修改ios/Podfile中的静态链接配置,同时添加Firebase相关框架的编译参数:use_frameworks! :linkage => :static pre_install do |installer| installer.pod_targets.each do |pod| if pod.name.start_with?('Firebase') || pod.name.start_with?('GoogleUtilities') pod.build_configurations.each do |config| config.build_settings['OTHER_LDFLAGS'] ||= [] config.build_settings['OTHER_LDFLAGS'] << '-ObjC' end end end end保存后重新执行
pod install,再尝试编译项目
内容的提问来源于stack exchange,提问作者faisal Rehman
相关产品推荐
相关产品推荐

