美文网首页📚苹果
多版本Cocoapods切换

多版本Cocoapods切换

作者: sttech | 来源:发表于2019-12-03 11:48 被阅读0次

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

安装Bundler

  • 使用 gem list --local | grep cocoapods 查看安装的Cocoaspod版本列表
 gem list --local | grep cocoapods
Cocoapod 版本列表
  • 通过pod --version 查看本地默认Cocoaspod版本
pod --version
本地默认Cocoaspod版本
  • 通过执行 gem install bundler 安装Bundler 若无权限
gem install bundler 
# 若无权限,则加上sudo
sudo gem install bundler
安装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切换

    本文链接:https://www.haomeiwen.com/subject/ldkcgctx.html