一丶介绍
CocoaPods是一个用来帮助我们管理第三方依赖库的工具。它可以解决库与库之间的依赖关系,下载库的源代码,同时通过创建一个Xcode的workspace来将这些第三方库和我们的工程连接起来,供我们开发使用。
使用CocoaPods的目的是让我们能自动化的、集中的、直观的管理第三方开源库。
二丶安装/更新
安装
# Xcode 7 + 8
$ sudo gem install cocoapods
出现 gems installed 安装完毕
更新
$pod setup
三丶使用
1.增
1.1初始化
$pod init
1.2.添加依赖库,修改Podfile

1.3.安装
$pod install
2.删
把Podfile的库删了,重新执行
$pod install
四丶技巧
1.快速更新
$cd ~/.cocoapods/repos
$git clone https://github.com/CocoaPods/Specs.git

打开repos文件夹,把Specs改成master名字

查看结果

2.快速安装依赖库,不更新
$pod install --no-repo-update
五丶其他
pod命令预览
Commands:
+ cache Manipulate the CocoaPods cache
+ deintegrate Deintegrate CocoaPods from your project
+ env Display pod environment
+ init Generate a Podfile for the current directory
+ install Install project dependencies according to versions from a
Podfile.lock
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
+ repo Manage spec-repositories
+ search Search for pods
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new Podfile.lock
Options:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
网友评论