cocoa pods的使用

2020-11-30  本文已影响0人  爱豆一颗心

cocoa pods


pod 命令汇总

# 第一次使用安装框架
$ pod install

# 今后升级、添加、删除框架,或者框架不好用
$ pod update

# 搜索框架
$ pod search XXX

# 在项目文件夹下创建默认的 Podfile
$ pod init

Pod file 格式说明

# 最低支持的 iOS 版本
platform :ios, '8.0'

# Swift 项目需要将框架转换为 frameworks 才能使用
use_frameworks!

# 框架列表
pod 'AFNetworking'

Pod 安装

# 添加并删除源,和下面分开的只需要用一种即可
$ sudo gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
# 添加源
$ sudo gem sources -a https://gems.ruby-china.com/
# 删除源
$ sudo gem sources -r https://rubygems.org/
# 查看源
$ gem sources -l
https://gems.ruby-china.com
# 确保只有 gems.ruby-china.com
# 安装
$ sudo gem install cocoapods
# 设置
$ pod setup

gem 常用命令

# 查看gem源
$ gem sources –l
# gem自身升级
$ sudo gem update --system
# 查看版本
$ gem --version
# 清除过期的gem
$ sudo gem cleanup
# 安装包
$ sudo gem install cocoapods
# 删除包
$ gem uninstall cocoapods
# 更新包
$ sudo gem update
# 列出本地安装的包
$ gem list

安装pod 库

# 第一种
$ git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/trunk
# 第二种
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git  ~/.cocoapods/repos/trunk

上一篇 下一篇

猜你喜欢

热点阅读