iOS执行pod install报错:找不到兼容的react-native-webrtc版本
解决React Native项目iOS端
pod install中react-native-webrtc版本兼容问题 你的React Native项目「Speed_Dating」在Android端运行正常,但iOS端执行pod install时出现CocoaPods could not find compatible versions for pod "react-native-webrtc"错误,核心原因是当前安装的react-native-webrtc@1.94.1与项目使用的React Native 0.66.4在iOS端存在版本兼容性冲突。
以下是具体解决步骤:
降级
react-native-webrtc到适配RN 0.66.4的版本- 卸载当前版本:
npm uninstall react-native-webrtc - 安装兼容版本(推荐1.89.1,该版本适配RN 0.66.x系列):
npm install react-native-webrtc@1.89.1 - 同步类型定义包版本(保持与安装的webrtc版本匹配):
npm uninstall @types/react-native-webrtc && npm install @types/react-native-webrtc@1.75.5
- 卸载当前版本:
清理iOS端缓存并重新安装Pods
- 进入项目iOS目录:
cd ios - 删除旧的Pod锁定文件和Pods文件夹:
rm -rf Podfile.lock Pods - (可选但推荐)删除Xcode衍生数据,避免缓存干扰:
rm -rf ~/Library/Developer/Xcode/DerivedData - 更新CocoaPods仓库索引:
pod repo update - 重新执行Pods安装:
pod install
- 进入项目iOS目录:
若上述步骤无效,额外检查:
- 查看项目iOS目录下的
Podfile,确认是否手动添加了react-native-webrtc的版本限制或自定义源,如有则调整为兼容RN 0.66.4的配置 - 确认Xcode版本为13.x(RN 0.66.4官方推荐版本,同时适配降级后的webrtc版本)
- 查看项目iOS目录下的
内容的提问来源于stack exchange,提问作者Alfaiz Khan
相关产品推荐
相关产品推荐

