Cocoa Pods 疑难杂症大杂烩

1.Setting up CocoaPods master repo

Setting up CocoaPods master repo 卡住
当pod setup 进入Setting up CocoaPods master repo 等待的时候表示正在下载了,此时你可通过新开一个终端窗口,输入"cd ~/.cocoapods/"命令行跳到cocoapods文件夹内,执行"du -sh *"查看正在下载的文件夹的大小
具体方法:

1.耐心等待

  1. cd /.cocoapods/
  2. du -sh *

2.None of your spec sources contain a spec satisfying the dependency

Cocoa Pods 疑难杂症大杂烩_第1张图片
图1.png

发现这是个已知的BUG, CocoaPods的版本库是有缓存的, 但在使用pod指令更新版本库时会出现冲突, 导致更新并不能如期完成, 需要手动删除本地缓存, 再进行更新.

具体方法:

pod setup

3.in `find_spec_for_exe': can't find gem cocoapods

//问题出现
 ➜  MMAlipayDemo git:(master) ✗ pod init
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
    from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
    from /usr/local/bin/pod:22:in `
'

解决方法:

sudo gem uninstall cocoapods
gem install cocoapods

4. Cocopods 遇到You don't have write permissions for the /usr/bin directory.

问题 升级pod的时候遇到 没有操作 /usr/bin 目录的权限
并且进行权限修改也无效果。

sudo gem update cocoapods --pre
Updating installed gems
Updating cocoapods
Fetching: concurrent-ruby-1.1.5.gem (100%)
Successfully installed concurrent-ruby-1.1.5
Fetching: httpclient-2.8.3.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.
sudo chmod 777 /usr/bin
Password:
chmod: Unable to change file mode on /usr/bin: Operation not permitted

解决方法:采用下方命令

sudo gem install cocoapods -n /usr/local/bin
pod --version
1.8.4 [升级完成]

5 操作repo

查看repo列表
pod repo list
删除repo
pod repo remove ******
更新repo
pod repo update

6 pod操作

更新pod
gem install cocoapods --pre
查看当前ruby源
gem sources

image.png

删除ruby源
gem sources --remove http://gems.ruby-china.org/
添加ruby源
gem sources -a https://gems.ruby-china.com/

7 CDN: error

[mumu]→ pod repo update --verbose
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because
checking is only perfomed in repo update

image.png

解决办法 参考
重装 psych

[mumu] → sudo gem install psych
8 升级Cocoa Pod

命令

$ sudo gem update --system
9 pod repo update 失败
Cocoa Pods 疑难杂症大杂烩_第2张图片
image.png

Updating spec repo cocoapods
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down

解决 安装 homebrew or 升级

 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

你可能感兴趣的:(Cocoa Pods 疑难杂症大杂烩)