主 Specs 存储库只是所有 PodSpec 的列表。
PodSpec 是:
规范描述了 Pod 库的版本。它包括有关应从何处获取源代码(哪个标签、提交或分支)、使用哪些文件、应用哪些构建设置以及其他一般元数据(例如名称、版本和描述)的详细信息。
specs 目录只是所有不同 PodSpec 的列表。每个 PodSpec 的版本都在一个标签目录下。该存储库不包含 pod 本身,只包含 PodSpec。PodSpec 给出了存储库的位置和许多其他元数据。⚡︎
spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
当你执行
pod repo update
时,你会从
https://github.com/CocoaPods/Specs拉取最新的PodSpecs(而不是实际的pod)。如果你只想更新单个pod源,那么只需执行
pod repo update [NAME]
。
Cocoapods/Specs主仓库:
![enter image description here](https://istack.dev59.com/ddJx3.webp)
一些 Alamofire PodSpecs 的列表
![enter image description here](https://istack.dev59.com/EWEVt.webp)
一个 单个的PodSpec 4.7.3:
![enter image description here](https://istack.dev59.com/sDIVy.webp)
⚡︎:
PodSpec: 一个规范描述了一个 Pod 库的版本。它包括从哪里获取源代码、使用哪些文件、应用哪些构建设置以及其他一般元数据,如名称、版本和描述等细节。
你的实际项目通过
pod update
或
pod install
将代码引入,然后物理文件会被下载到你的Mac并复制到你的项目中。
经常会出现这个错误:
None of your spec sources contain a spec satisfying the dependencies:
AlamoFire (= 11.0.3), AlamoFire (= 11.0.3)
.
You have either: * out-of-date source repos which you can update with
pod repo update
or with pod install --repo-update
. * mistyped the
name or version. * not added the source repo that hosts the Podspec
to your Podfile.
Spec sources很重要。它只是意味着你没有拉取规格。你可以通过执行
pod repo
轻松查看你拥有的规格源。我的是:
cocoapods
- Type: git (remotes/origin/master)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/mfaani/.cocoapods/repos/cocoapods
private_pods
- Type: git (master)
- URL: git@github.company.com:xyz/private_Cocoapods.git
- Path: /Users/mfaani/.cocoapods/repos/private_cocoapods
trunk
- Type: CDN
- URL: https://cdn.cocoapods.org/
- Path: /Users/mfaani/.cocoapods/repos/trunk