ios CocoaPods 如何只安装一个新库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28590013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CocoaPods how to install only one new library
提问by Matrosov Alexander
I have a list of libraries in my Pod file. I decide to add new one to Pod file. But I want to keep all my previous libraies without updates and just install (add) this one library
我的 Pod 文件中有一个库列表。我决定在 Pod 文件中添加一个新的。但我想保留我以前的所有库而不更新,只需安装(添加)这个库
pod 'JSAnimatedImagesView', '~> 1.0.0'
so pod update
and pod install
update all libraries to newer versions, but I don't want to update them just install pod 'JSAnimatedImagesView', '~> 1.0.0'
所以pod update
并将pod install
所有库更新到较新版本,但我不想更新它们只是安装pod 'JSAnimatedImagesView', '~> 1.0.0'
回答by Miro
pod install --no-repo-update
This installs new items without updating existing repos (versioned or not).
这将安装新项目而不更新现有存储库(版本控制与否)。
It's also just quicker if you have a lot of repos and want a fast install of a new item.
如果您有很多存储库并希望快速安装新项目,它也会更快。
回答by BennyTheNerd
(As of March 15, 2019)
(截至 2019 年 3 月 15 日)
To install 1 new pod: add the 1 desired new pod into your Podfile. Then run:
要安装 1 个新 pod:将 1 个所需的新 pod 添加到您的 Podfile 中。然后运行:
pod install --no-repo-update
It will not update any other podswhen running this.
运行此程序时,它不会更新任何其他 pod。
回答by davbryn
If you don't want to update the specific libraries you should lock them at the versions you want to keep
如果您不想更新特定的库,您应该将它们锁定在您想要保留的版本上
pod 'AFNetworking', '1.2.0'
pod 'JSAnimatedImagesView', '~> 1.0.0'
Would keep AFNetworking
on V1.2.0 but get the latest JSAnimatedImagesView
将继续AFNetworking
使用 V1.2.0 但获取最新版本JSAnimatedImagesView
This makes the podfile transferrable to other locations (and developers) and saves you from forgetting to revert your podfile until you intend to update pods
这使得 podfile 可以传输到其他位置(和开发人员),并避免您在打算更新 pod 之前忘记恢复 podfile
回答by Alena
You can try to use update command https://guides.cocoapods.org/terminal/commands.html#pod_update
您可以尝试使用更新命令https://guides.cocoapods.org/terminal/commands.html#pod_update
pod update [POD_NAMES ...]
pod update [POD_NAMES ...]
Updates the Pods identified by the specified POD_NAMES. If no POD_NAMES are specified it updates all the Pods ignoring the contents of the Podfile.lock.
更新由指定的 POD_NAMES 标识的 Pod。如果没有指定 POD_NAMES,它会更新所有 Pod,而忽略 Podfile.lock 的内容。
回答by nspavlo
When starting out with a project it is likely that you will want to use the latest version of a Pod. If this is the case, simply omit the version requirements.
在开始一个项目时,您可能希望使用最新版本的 Pod。如果是这种情况,只需省略版本要求。
pod 'SSZipArchive'
Later on in the project you may want to freeze to a specific version of a Pod, in which case you can specify that version number.
稍后在项目中,您可能希望冻结到 Pod 的特定版本,在这种情况下,您可以指定该版本号。
pod 'Objection', '0.9'
More info http://guides.cocoapods.org/syntax/podfile.html#pod