CocoaPods


1. CocoaPods的安装

github

CocoaPods官网

1.1 安装RVM

$ curl -L get.rvm.io | bash -s stable

1.2 测试是否正常安装

$ source ~/.bashrc

$ source ~/.bash_profile 

$ rvm -v

1.3 安装Ruby

$ ruby -v

$ rvm list known

$ rvm install 2.3.3

1.4 如果出现错误则执行下条语句

$ brew update && brew install gmp

1.5 安装CocoaPods

$ gem install cocoapods

$ gem update --system

$ gem -v # 2.6.10

1.6 修改Pod源

$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/

$ gem sources -l # https://gems.ruby-china.org 确保只有 gems.ruby-china.org

1.7 最后一步

$ pod setup

2.CocoaPods的使用

2.1 创建Podfile

进入工程目录

$ pod init

会生成这样一个文件

# Uncomment this line to define a global platform for your project

target 'YourProjectName' do

# platform :ios, '8.0'

#    Uncomment this line if you're using Swift or would like to use dynamic frameworks

#    use_frameworks!

#    Pods for YourProjectName

end


2.2 第三方库的安装与更新

终端执行

$ pod install # 不会更新本地仓库

$ pod update 

$ pod repo update # 更新本地仓库

2.3 屏蔽第三方库里的警告

在Podfile里加入 inhibit_all_warnings!

e.g.

# Uncomment this line to define a global platform for your project

target 'YourProjectName' do

platform :ios, '8.0'

inhibit_all_warnings!

#    Uncomment this line if you're using Swift or would like to use dynamic frameworks

#    use_frameworks!

#    Pods for YourProjectName

pod 'AWERatingBar', '~> 0.1.0' 

end

3.CocoaPods的卸载


#   gem uninstall cocoapods

你可能感兴趣的:(CocoaPods)