$ pod init
第一行:指明项目支持的iOS版本
platform :ios, '8.0'
CocoaPods现在是通过target来组织的,如果项目有多个target,可以写多个target为每个target引入不同的第三方库。
写法:
target '78S_iOS' do
# pod 'xxx'
endworkspace 'MyWorkspace'pod install 什么时候用pod update pod install 用来为项目安装新的pod,不管你以前有没有运行过pod install, 当在Podfile中添加或删除了pod时,都应该用pod install,(可以理解为你更新的你的Podfile文件 ,就用'pod install')。pod install Podfile中添加的新pod,并且打下载的pod的版本信息等写到Podfile.lock文件中。Podfile.lock文件中不存在的pod,如果Podfile.lock文件中已经存在的pod,只会下载Podfile.lock文件中保存的版本,就算这个时候这个库有一个新的版本,也不会去更新。对于Podfile.lock文件中不存在的pod,会下载Podfile文件中声明的版本。pod outdated CocoaPods会列出Podfile.lock文件中保存的版本过旧的库(就是会列出有新版本的库)pod update [PODNAME] pod的版本到最新版本,如果不指定pod,则会更新所有的库到最新版本。所以为了让一个team里所有人的库都保持在一个相同的版本,版本控制要上传Podfile.lock文件。尽量不要用pod update pod update这个命令会带上pod repo update,repo更新会很慢,可以添加参数--no-repo-update来跳过repo update.CocoaPods库的创建pod lib create ScalableImageView还可以通过--template-url=你的url来指定模版。可以clone官方模版 模版做一些定制修改。

官方模版会有几个选项:
Objective-C or Swift Demo项目UI测试框架Objective-C的前缀目录结构:

podspec文件pod到trunk 仓库pod lib lint这个命令是在本地检查,不用连接网络pod spec lint要联网,会检查是远端trunk tag pod trunk register orta@cocoapods.org 'Orta Therox' --description='macbook air' 这条命令会发一个邮件到你提供的邮箱中,点击验证后才能进行下面的操作。pod trunk me来查看你的授权信息pod trunk push将当前pod提交到trunkCocoaPods支持podspec文件即可pod spec create xxx来创建podspec文件,更改文件对应的设置就可以github或者自己的git服务器上创建一个repo来存放Spec Repo repo添加到CocoaPods中pod repo add REPO_NAME SOURCE_URL(仓库地址) (repo名最好跟仓库名保持一致)验证是否安装成功
cd ~/.cocoapods/repos/REPO_NAME pod repo lint .
pod repo push REPO_NAME SPEC_NAME.podspec在Podfile文件中添加源
source 'https://github.com/xx/xx.git' // 自己的源
source 'https://github.com/CocoaPods/Specs.git' // 官方源