Xcode 13中x86_64架构符号未找到问题求助
解决方案
针对你在M1 Mac mini上集成FCM遇到的x86_64符号未找到问题,试试下面几个针对性方案:
1. 修正Podfile的pre_install配置
你的问题大概率是静态/动态库的链接冲突,调整pre_install块,确保Google相关依赖被正确处理:
$static_framework = ['Firebase', 'FirebaseCore', 'FirebaseMessaging', 'GoogleUtilities', 'FirebaseInstallations', 'FirebaseCoreDiagnostics'] pre_install do |installer| installer.pod_targets.each do |pod| if $static_framework.include?(pod.name) def pod.build_type; Pod::BuildType.static_library end end end end
然后执行:
rm -rf Pods Podfile.lock arch -x86_64 pod install
2. 调整Xcode Build Settings
打开iOS项目的Xcode工程,修改以下设置:
- 找到Build Settings > Architectures > Valid Architectures,添加
x86_64和arm64 - 找到Build Settings > Linking > Other Linker Flags,添加
-ObjC(如果已经有就忽略) - 找到Build Settings > Build Options > Build Active Architecture Only,Debug模式设为
YES,Release模式设为NO
3. 清理所有缓存后重新构建
执行以下命令彻底清理:
# 清理RN缓存 npm cache clean --force watchman watch-del-all rm -rf node_modules npm install # 清理iOS缓存 rm -rf ios/Pods ios/Podfile.lock ios/build rm -rf ~/Library/Developer/Xcode/DerivedData arch -x86_64 pod install # 重新运行 react-native run-ios --simulator="iPhone 14"
4. 检查版本兼容性
确保你的React Native版本和@react-native-firebase/messaging版本匹配,比如RN 0.70+对应RN Firebase 15.x+,版本不匹配容易导致底层依赖冲突。
如果以上方法还是不行,打开Xcode的Report Navigator,找到具体的错误日志,查看是哪个库缺失了google::LogMessage符号,然后把对应的库加入到$static_framework列表里,再重新pod install。
内容的提问来源于stack exchange,提问作者Lahiru Gunathilake
相关产品推荐
相关产品推荐

