遇到情况:

我这边使用RxSwift,但是 RxSwift 在github上部署,有的时候网络不好所以我把RxSwift 拉倒我的Giee仓库中,以方便更好的使用在 profile 中使用时候添加

pod 'RxSwift', :git=> 'https://gitee.com/tripartite/RxSwift.git', :tag=> '6.5.0'

pod 'RxCocoa', :git=> 'https://gitee.com/tripartite/RxSwift.git', :tag=> '6.5.0'

但是pod install 时候缺遇到了问题, 单独一个 RxSwift没有问题,但是 RxCocoa始终报错

[!] CocoaPods could not find compatible versions for pod "RxRelay":

In Podfile:

RxCocoa (from `https://gitee.com/tripartite/RxSwift.git`, tag `6.5.0`) was resolved to 6.5.0, which depends on

RxRelay (= 6.5.0)

None of your spec sources contain a spec satisfying the dependency: `RxRelay (= 6.5.0)`.

问题原因分析

RXSwift 原文件下面有多个.podspec 如下图,他们之间产生了依赖关系,打开RxCocoa.podspec,你就发现 RxCocoa 需要依赖 RxSwift 和 RxRelay

s.dependency 'RxSwift', '6.5.0'

s.dependency 'RxRelay', '6.5.0'

解决方法,添加依赖

添加依赖,然后pod install ,问题解决

pod 'RxSwift', :git=> 'https://gitee.com/tripartite/RxSwift.git', :tag=> '6.5.0'

pod 'RxRelay', :git=> 'https://gitee.com/tripartite/RxSwift.git', :tag=> '6.5.0'

pod 'RxCocoa', :git=> 'https://gitee.com/tripartite/RxSwift.git', :tag=> '6.5.0'

查看原文