Nativescript和Stripe集成:Podfile中对Stripe的依赖项重复

问题描述

我在Angular / Nativescript应用程序中集成Stripe时遇到问题。 由于我已将Stripe添加到应用程序中,因此当我启动“ tns run ios”命令时出现以下错误

Analyzing dependencies
[!] CocoaPods Could not find compatible versions for pod "Stripe":
  In Podfile:
    Stripe (= 13.2)

    Stripe (~> 19.0.1)

None of your spec sources contain a spec satisfying the dependencies: `Stripe (~> 19.0.1),Stripe (= 13.2)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

[!] There are duplicate dependencies on `Stripe` in `Podfile`:

- Stripe (~> 19.0.1)
- Stripe (= 13.2)
'pod install' command Failed.

我可以看到,在构建项目时,我可以在“ platforms / ios / PodFile”中看到两个版本的Stripe:

# Begin Podfile - /Users/corentin/Desktop/CODE/arian-fitness/node_modules/nativescript-stripe/platforms/ios/Podfile
# platform :ios,'10.0'
pod 'Stripe','~> 19.0.1'

# Begin Podfile - /Users/corentin/Desktop/CODE/arian-fitness/node_modules/nativescript-stripe-sdk/platforms/ios/Podfile
# platform :ios,'9.0'
pod 'Stripe','13.2'
# End Podfile

有人知道要处理这种重复吗?

解决方法

您似乎正在使用使用Stripe 11.3的NativeScript Stripe项目版本:https://github.com/piotrilski/nativescript-stripe-sdk

项目的自述文件建议改用此版本,该版本支持19.0.1: https://github.com/triniwiz/nativescript-stripe

无论哪种情况,都必须在Podfile和项目中使用与所选Nativescript库使用的相同版本的Stripe SDK。