CocoaPods相关 | CocoaPods(二)简单用法及常
2018-05-29 本文已影响4人
JasonL
常见的错误
- Unable to find a pod with name, author, summary, or description matching
rm ~/Library/Caches/CocoaPods/search_index.json (第一步)
pod search afnetworking (第二步)
- can't find gem cocoapods (>= 0.a)
1: sudo gem uninstall cocoapods
2: gem install cocoapods
3: pod install
三、 使用
Step1: 使用终端进入到你的工程目录
[图片上传失败...(image-179df1-1527579677127)]
cd 目标文件夹路径(直接拖过来就行)
Step2: 执行pod init 指令
pod init
执行成功后会出现一个 Podfile 的文件 这里可以用终端的vim 进行编辑 我这里直接拖到xcode上打开进行编辑(推荐使用Vim)
打开后出现
Step3: 编辑Podfile文件 并保存
# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'
target 'YYChatProgram' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'AFNetworking'
# Pods for YYChatProgram
target 'YYChatProgramTests' do
inherit! :search_paths
# Pods for testing
end
target 'YYChatProgramUITests' do
inherit! :search_paths
# Pods for testing
end
end
Step4: 终端执行命令 pod install
pod install
执行安装完成