ios - 如何知道您的 cocoapod 安装指向哪个 pod 规范文件
<p><p>我正在尝试安装 <a href="https://github.com/ShareKit/ShareKit" rel="noreferrer noopener nofollow">sharekit</a>通过cocoapods。如果我在 cocoapod 网站上搜索 sharekit.. 我被指示将其放入 podfile 中:</p>
<pre><code>pod 'ShareKit', '~> 2.5'
</code></pre>
<p>网站上的sharekit pod链接到<a href="https://github.com/CocoaPods/Specs/blob/master/ShareKit/2.5.6/ShareKit.podspec" rel="noreferrer noopener nofollow">this</a> podspec 文件,标记为 2.5.6。</p>
<p>到目前为止一切顺利。</p>
<p>但是当我运行 <code>pod install</code> 命令时(我还添加了 <code>platform :ios, '6.0'</code> b/c 不这样做会引发兼容性错误)我明白了错误:</p>
<blockquote>
<p>[!] Unable to satisfy the following requirements:
- <code>SSKeychain (~> 0.2.1)</code> required by <code>ShareKit/Core (2.5.6)</code>- <code>SSKeychain (~> 1.2.2)</code> required by <code>Evernote-SDK-iOS (1.3.1)</code></p>
</blockquote>
<p>我的问题是:为什么它说明 <strong>evernote 1.3.1</strong> 需要什么? b/c 2.5.6 podspec 里面有这个:</p>
<pre><code>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
</code></pre>
<p>所以它显然链接到 <strong>evernote 1.3.0</strong></p>
<p><a href="https://github.com/ShareKit/ShareKit/blob/master/ShareKit.podspec" rel="noreferrer noopener nofollow">podspec</a>在 sharekit master repo 上确实将 <strong>evernote 1.3.1</strong> 列为依赖项..但这与我的 pod 安装请求有什么关系? </p>
<p>让事情变得更奇怪.. 我放 <code>pod 'ShareKit', '~> 2.5.6'</code> 或 <code>pod 'ShareKit', '~> 2.5 都没关系.3'</code>.. 我在谈论 sharekit 2.5.6 时仍然遇到错误.. 为什么会这样?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>下面解释了如何将 pod 版本链接到您的项目中(它与 <a href="http://semver.org/" rel="noreferrer noopener nofollow">Semantic Versioning</a> 密切相关。</p>
<blockquote>
<p>Besides no version, or a specific one, it is also possible to use logical operators:</p>
<p>'> 0.1' Any version higher than 0.1</p>
<p>'>= 0.1' Version 0.1 and any higher version</p>
<p>'< 0.1' Any version lower than 0.1</p>
<p>'<= 0.1' Version 0.1 and any lower version</p>
<p>In addition to the logic operators CocoaPods has an optimisic operator ~>:</p>
<p>'~> 0.1.2' Version 0.1.2 and the versions up to 0.2, not including 0.2 and higher</p>
<p>'~> 0.1' Version 0.1 and the versions up to 1.0, not including 1.0 and higher</p>
<p>'~> 0' Version 0 and higher, this is basically the same as not having it.</p>
</blockquote>
<p>来源:<a href="http://guides.cocoapods.org/using/the-podfile.html" rel="noreferrer noopener nofollow">http://guides.cocoapods.org/using/the-podfile.html</a> </p>
<p>如果您想明确链接到特定版本,请将您的 podfile 更改为以下内容:</p>
<pre><code>pod 'ShareKit', '2.5'
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何知道您的 cocoapod 安装指向哪个 pod 规范文件,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/23286127/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/23286127/
</a>
</p>
页:
[1]