cocoapods安装配置及使用

环境:

  Ruby版本:ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]

  cocoapods版本:1.10.0

 

1.切换Ruby镜像源

gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com/
#验证
gem sources -l

2.安装cocoapods

sudo gem install cocoapods

3.指定cocoapods镜像源

pod remove master
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

4.配置podfile

#1.在项目所在目录创建podfile文件
#2.指定pod repo update时cocoapods镜像源
#3.指定工作空间所在目录
#4.target do end指定第三方库依赖的目标项目

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
workspace '/Users/breeze/Desktop/DemoApp/DemoApp.xcodeproj'
target    'DemoApp' do

platform :ios, '14.3'
pod 'AFNetworking', '~> 4.0.1'

end

5.导入第三方库

pod install
posted @ 2021-01-03 19:56  微风~~  阅读(253)  评论(0编辑  收藏  举报