多版本Cocoapods切换

前言
在开发过程中,会出现切换Cocoapods版本情况.

安装Bundler

  • 使用 gem list --local | grep cocoapods 查看安装的Cocoaspod版本列表
 gem list --local | grep cocoapods
多版本Cocoapods切换_第1张图片
Cocoapod 版本列表
  • 通过pod --version 查看本地默认Cocoaspod版本
pod --version
多版本Cocoapods切换_第2张图片
本地默认Cocoaspod版本
  • 通过执行 gem install bundler 安装Bundler 若无权限
gem install bundler 
# 若无权限,则加上sudo
sudo gem install bundler
多版本Cocoapods切换_第3张图片
安装Bundler

使用

  • 入到项目所在的根目录(即 Podfile 所在的目录)
  • 终端执行 bundle init ,会生成Gemfile文件,Gemfile文件和Podfile文件非常相似。
bundle init
  • 编写Gemfile文件 (和Podfile文件编写方式类似)
# frozen_string_literal: true
source "https://rubygems.org"
gem 'cocoapods','1.8.4'
  • 如果未安装指定版本的Cocoapod 需要执行bundle install
bundle install
  • 执行 bundle exec pod install
bundle exec pod install

你可能感兴趣的:(多版本Cocoapods切换)