安装遇到的问题:
Error fetching https://rubygems.org/:
Errno::ETIMEDOUT: Operation timed out - connect(2) (http://rubygems.org/specs.4.8.gz);
那就是国内的网络环境的问题访问镜像源超时。可以用
gem sources -l
查看当前的镜像地址,这种情况要改用淘宝的镜像源,采用
gem source -r https://rubygems.org/
去掉当前的,再用
gem sources -a https://ruby.taobao.org/
更改过来,这时再用
gem sources -l
就可以看到
*** CURRENT SOURCES ***
https://ruby.taobao.org/
了。然后再输入安装命令安装。安装过程还可能出现这个错误
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory
.我采取的做法是把权限修改过来用命令
sudo chmod 777 /Library/Ruby/Gems/2.0.0;
然后
pod setup
就好了。
最新podfile文件的格式:
platform :ios, ‘8.0’
use_frameworks!
target 'aiyazhege' do 备注:'aiyazhege' 就是你的工程名字
pod 'SwiftyJSON', '~> 2.3.2'
pod 'SDAutoLayout', '~> 2.0.0'
end
podfile升级之后到最新版本,pod里的内容必须明确指出所用第三方库的target,否则会出现The dependency `` is not used in any concrete target这样的错误。其实就是podfile写的格式错误,修改下就好了!
网友评论