0%

CocoaPods周边

反馈请联系hertz@hertzwang.com,谢谢

Ruby相关

  1. 下载安装Ruby https://www.ruby-lang.org/en/
  2. 升级Ruby环境 $ sudo gem update
  3. 查看Ruby镜像 $ gem sources -l
  4. 移除Ruby镜像 $ gem sources --remove 镜像地址
  5. 添加Ruby镜像 $ gem sources --add 镜像地址
  6. 查看Ruby安装的包 $ gem list$ /usr/bin/gem list
  7. 移除Ruby安装的包 $ sudo gem uninstall PACKAGENAME -v xx.xx.xx

注:

  1. RubyGems 镜像参考https://gems.ruby-china.com
  2. Ruby环境分 systemlocal,路径分别是 /usr/bin/gem/usr/local/bin/gem
  3. 系统自带没有权限时需要下载Ruby,brew install ruby

CocoaPods相关

  1. 安装CocoaPods $ sudo gem install cocoapods

  2. 卸载CocoaPods $ sudo gem uninstall cocoapods

  3. 查询三方版本信息 $ pod search 项目名

  4. 根据Podfile集成 $ pod install

  5. Podfile 模板

    1
    2
    3
    4
    5
    6
    platform :ios, '8.0'
    use_frameworks!

    target 'MyApp' do
    pod 'AFNetworking', '~> 3.0'
    end
  6. 注册CocoaPods $ pod trunk register 邮箱地址 '用户名' --verbose,注册后需要邮件确认

  7. 查看CocoaPods信息 $ pod trunk me

  8. 创建共享库 $ pod lib create 库名

  9. 更新CocoaPods库(需要等待)

     $ sudo gem install cocoapods
     $ pod repo
     $ pod setup
     
     
    
  10. 查看本地库大小

     $ cd ~/.cocoapods/
     $ du -sh *
     
    
  11. 清理 Cocoapods

    *

注:参考 https://guides.cocoapods.org

问题

brew install xxx 提示”ERROR: No formulae found in taps.”

解决方案【转载:Homebrew执行命令时出错的解决方案

1.删除taps:rm -rf /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
2.更新brew:brew update

升级 Mac OS 导致 -bash: pod: command not found

解决方案【转载:解决升级EI Capiton CocoaPods “pod: command not found”

1.为了安全起见,执行命令”sudo gem uninstall cocoapods”,卸载原有的CocoaPod

2.执行命令”sudo gem install -n /usr/local/bin cocoapods”来重新安装cocoapod

3.如果没有权限执行pod,执行命令”sudo chmod +rx /usr/local/bin/“,赋予/usr/local/bin给予执行与读取权限

参考链接:https://github.com/CocoaPods/CocoaPods/issues/3736

升级 MacOS High Sierra 导致 bad interpreter: No such file or directory

$ sudo gem update --system
$ sudo gem install cocoapods -n/usr/local/bin

参考链接:http://www.cocoachina.com/bbs/read.php?tid-1727144-page-e.html