OGeek|极客世界-中国程序员成长平台

标题: ios - 如何知道您的 cocoapod 安装指向哪个 pod 规范文件 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 07:29
标题: ios - 如何知道您的 cocoapod 安装指向哪个 pod 规范文件

我正在尝试安装 sharekit通过cocoapods。如果我在 cocoapod 网站上搜索 sharekit.. 我被指示将其放入 podfile 中:

pod 'ShareKit', '~> 2.5'

网站上的sharekit pod链接到this podspec 文件,标记为 2.5.6。

到目前为止一切顺利。

但是当我运行 pod install 命令时(我还添加了 platform :ios, '6.0' b/c 不这样做会引发兼容性错误)我明白了错误:

[!] Unable to satisfy the following requirements: - SSKeychain (~> 0.2.1) required by ShareKit/Core (2.5.6)- SSKeychain (~> 1.2.2) required by Evernote-SDK-iOS (1.3.1)

我的问题是:为什么它说明 evernote 1.3.1 需要什么? b/c 2.5.6 podspec 里面有这个:

s.subspec 'Evernote' do |evernote|
   evernote.source_files = 'Classes/ShareKit/Sharers/Services/Evernote/**/*.{h,m}'
   evernote.dependency 'Evernote-SDK-iOS', '~> 1.3.0'
   evernote.dependency 'ShareKit/Core'
   evernote.libraries = 'xml2'
   evernote.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }
 end

所以它显然链接到 evernote 1.3.0

podspec在 sharekit master repo 上确实将 evernote 1.3.1 列为依赖项..但这与我的 pod 安装请求有什么关系?

让事情变得更奇怪.. 我放 pod 'ShareKit', '~> 2.5.6'pod 'ShareKit', '~> 2.5 都没关系.3'.. 我在谈论 sharekit 2.5.6 时仍然遇到错误.. 为什么会这样?



Best Answer-推荐答案


下面解释了如何将 pod 版本链接到您的项目中(它与 Semantic Versioning 密切相关。

Besides no version, or a specific one, it is also possible to use logical operators:

'> 0.1' Any version higher than 0.1

'>= 0.1' Version 0.1 and any higher version

'< 0.1' Any version lower than 0.1

'<= 0.1' Version 0.1 and any lower version

In addition to the logic operators CocoaPods has an optimisic operator ~>:

'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher

'~> 0.1' Version 0.1 and the versions up to 1.0, not including 1.0 and higher

'~> 0' Version 0 and higher, this is basically the same as not having it.

来源:http://guides.cocoapods.org/using/the-podfile.html

如果您想明确链接到特定版本,请将您的 podfile 更改为以下内容:

pod 'ShareKit', '2.5'

关于ios - 如何知道您的 cocoapod 安装指向哪个 pod 规范文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23286127/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4