cocoapods的安装
1.安装过程中如果出现以下错误提示:1
2ERROR: While executing gem ... (OpenSSL::SSL::SSLError)
hostname "rubygems-china.oss.aliyuncs.com" does not match the server certificate
移除镜像:1
gem sources --remove https://rubygems.org/
使用https://gems.ruby-china.com/
镜像:1
gem sources -a https://gems.ruby-china.com/
2.查看镜像:1
gem sources -l
3.安装cocoapods:1
sudo gem install -n /usr/local/bin cocoapods
安装Homebrew
1 | //ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
安装npm和node
1 | brew install node |
cocoapods的使用
1 | //拉取最新pod库时间较长 |
Podfile:1
2
3
4
5
6
7
8
9platform :ios, ’9.0’
target 'xxx' do
use_frameworks!
pod 'AFNetworking'
pod 'SDWebImage'
pod 'MJExtension'
pod 'MJRefresh'
pod 'MBProgressHUD'
end
在swift中配置Podfile文件时要加上 use_frameworks!
,作用是把三方库打包成静态库。