安装
省略
添加三方库
- 到某个文件夹下新建一个名叫Podfile的文件,无后缀
内部格式为(以swift为例)
#Uncomment this line to define a global platform for your project #platform :ios, '8.0' target 'SwiftProject' do #Comment this line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for Zoharo_swift pod 'SwiftHEXColors', '~> 1.0.4' pod 'BaiduMapKit' #百度地图SDK target 'Zoharo_swiftTests' do inherit! :search_paths # Pods for testing end end
其中
pod 'SwiftHEXColors', '~> 1.0.4'
第一个引号里是三方库的名称,第二个引号里是最低版本号,版本号不是必须的。打开Terminal,cd到Podfile所在的文件夹,准备加载Podfile文件中指定的三方库。加载分为两种方式:
pod install
pod update
不过当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:pod install --verbose --no-repo-update pod update --verbose --no-repo-update
- 更新pods的时候可能会遇到一些问题,可以参考这里:http://blog.youkuaiyun.com/wangyanchang21/article/details/51437934