1. 用終端打開到工程根目錄;
2. 輸入pod init裹驰;
3. 打開Podfile文件;
4. 刪除platform :ios, '9.0'和use_frameworks!前面的#贞盯,添加需要的第三方沪饺;
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'TestTargetName' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for TestTargetName
pod 'AFNetworking', '~> 3.1.0'
target 'TestTargetNameTests' do
inherit! :search_paths
# Pods for testing
end
target 'TestTargetNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
5. 上面的代碼已經(jīng)加入了常用的AFNetworking随闽,實(shí)際根據(jù)需要《晟龋可以在終端輸入例如:pod search AFNetworking 搜索需要的第三方魏滚;
6. 第一次加入第三方,在終端打開到工程目錄用 pod install初始化更哄,后續(xù)添加第三方使用pod update更新。