ios - 如何知道您的 cocoapod 安装指向哪个 pod 规范文件

标签 ios objective-c git cocoapods sharekit

我正在尝试安装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 时仍然遇到错误..这是为什么?

最佳答案

下面解释了如何将 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/

相关文章:

ios - 图像的 Swift 类型注释

android - 在 Objective C、.net 和 Android 中生成相同的加密字符串 AES/CBC/PKCS7Padding

ios - 自动布局、约束和动画

objective-c - 移除 UIPopOver permittedArrowDirections

Git pull 错误 "unable to update local ref"如何解决?

git - 为什么 'git mergetool' (meld) 显示冲突标记?

ios - 使用 mapView :didAddAnnotationViews: from MKMapViewDelege and MGLMapViewDelegate errors

iphone - 如何从 iPhone 应用程序中启动 iPhone 日历?

iphone - 为 iPhone 应用程序存储数据

git - 我如何压缩 zlib 数据并找出有多少输入字节?