You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native集成Stripe遇CocoaPods版本兼容问题求助

解决CocoaPods无法找到StripePayments兼容版本的问题

1. 更新CocoaPods本地spec仓库

先确保本地spec源是最新状态,执行命令:

pod repo update

如果更新速度慢,可清空旧缓存后重新更新:

rm -rf ~/.cocoapods/repos/trunk
pod repo update

2. 切换CocoaPods源(若默认源有延迟)

移除原有trunk源并替换为国内镜像源:

pod repo remove trunk
pod repo add trunk https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git

完成后再次执行 pod install

3. 手动指定StripePayments版本

在ios/Podfile中直接添加依赖声明:

pod 'StripePayments', '~>23.27.0'

随后执行:

pod install --repo-update

4. 清理项目缓存后重新安装依赖

  • 清理Node.js依赖缓存:
rm -rf node_modules package-lock.json yarn.lock
npm install
  • 清理iOS构建缓存:
cd ios
rm -rf Pods Podfile.lock
pod install

5. 升级CocoaPods版本(可选)

当前CocoaPods 1.15.2虽兼容目标版本,但仍可尝试升级到最新稳定版:

sudo gem install cocoapods

6. 降低stripe-react-native版本(兜底方案)

若以上方法均无效,可降级@stripe/stripe-react-native到依赖更低版本StripePayments的分支:

npm uninstall @stripe/stripe-react-native
npm install @stripe/stripe-react-native@0.36.5

之后执行 pod install --repo-update

内容的提问来源于stack exchange,提问作者alokkumardubey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 06:01:03