1.cd到当前项目路径
cd /Users/xxx/GitRepository/xcode/xxx
2.输入
touch podfile
3.输入
open podfile
4.回到终端
输入 pod search AFN
以AFNNetworking为例(搜索不需要输入完整名称)
5.粘贴pod 'AFNetworking', '~> 3.0'
到podfile 保存并关闭
podfile中格式为:
target 'xxx' do
pod 'AFNetworking', '~> 3.0'
end
注意:最新版本cocoapod 需要加入target
target 'xxx' do
.....
end
6.最后 终端输入
pod install --no-repo-update
7.只能 xcworkspace
+ 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