如何更改Cocoapod依赖项的版本 [英] How to change the version of a Cocoapod's dependency
问题描述
我正在使用一个Cocoapod,其 podspec
指定了一个依赖关系,而该依赖关系又指定了另一个依赖关系.
I am using a Cocoapod whose podspec
specifies a dependency, and this dependency in turn specifies another.
有问题的第二级依赖项与最新的beta版本的Xcode 9冲突.该问题已在项目的github中修复,但尚未在Cocoapods上出现.
The second-level dependency in question has a conflict with the latest beta version of Xcode 9. The issue has been fixed in the project's github but it has not appeared on Cocoapods yet.
但是依赖项本身当然不会出现在我的Podfile中.
But the dependency itself of course does not appear in my Podfile.
在这种情况下,是否有一种简单的方法可以强制使用特定版本的依赖项?
Is there an easy way to force the use of a specific version of the dependency in this case?
推荐答案
我通过将特定版本的依赖项添加到我自己的Podfile中来解决了这个问题.
I solved this by simply adding the specific version of the dependency to my own Podfile.
之所以可行,是因为您的项目中不能有一个Cocoapod的多个版本.
This works because you cannot have multiple versions of a single Cocoapod in your project.
示例:
pod 'MatrixKit', :git => 'https://github.com/My-Fork/matrix-ios-kit.git', :branch => 'master'
pod 'MatrixSDK', :git => 'https://github.com/My-Fork/matrix-ios-sdk.git', :branch => 'master'
pod 'MatrixSDK/Core', :git => 'https://github.com/My-Fork/matrix-ios-sdk.git', :branch => 'master'
pod 'Realm', :git => 'https://github.com/My-Fork/realm-cocoa.git', :tag => 'v10.1.4', submodules: true
这篇关于如何更改Cocoapod依赖项的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!