单target的podfile文件
1 | source 'https://github.com/CocoaPods/Specs.git' |
多个target的podfile文件
1 | source 'https://github.com/CocoaPods/Specs.git' |
do/end作为开始和结束标识符
Podfile管理pods依赖库版本
再引入依赖库时,需要显示或隐式注明引用的依赖库版本,常用具体写法和表示含义如下:
1 | pod 'AFNetworking' //不显式指定依赖库版本,表示每次都获取最新版本 |
Podfile 引入特殊节点
有时我们需要引入依赖库指定的分支或节点,写法如下:
引入master分支(默认)
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git'
引入指定的分支
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => 'dev'
引入某个节点的代码
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0'
引入某个特殊的提交节点
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'
引入本地路径下代码
pod 'AFNetworking', :path => '../../../'
引入某库下面某几个subspec
pod 'AFNetworking', :subspecs=>['Reachability','Security'] 或
pod 'AFNetworking', '~>0.1', :subspecs=>['Reachability','Security']