Ruby的版本
$ gem update --system # 这里请翻墙一下
$ gem -v
2.6.3 # 建议 2.6.x 以上
替换源
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.com # 确保只有 gems.ruby-china.com
gem相关命令:
$ gem sources -l #显示当前地址
gem sources -a url 地址 #添加一个source
gem sources -r url 地址 #删除一个source
gem sources -u #更新source cache
遇到的error
1.xcode报错
could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
解决方法:进入到ios文件夹,然后执行
pod install
关于找不到Podfile的问题:报错如下
[!] No `Podfile' found in the project directory.
解决问题:确认ios目录下是否有Podfile文件夹
注意:Podfile文件要放在 XXX.xcodeproj 和 XXX.xcworkspace 同一目录下
如果没有:
1.cd到自己的项目ios目录下
2.vim Podfile(创建Podfile)
3.出现以下代码
source'https://github.com/CocoaPods/Specs.git'
platform:ios,'8.0'
inhibit_all_warnings!
target '工程名' do
pod 'AFNetworking', '~> 2.6.0'
end
4.保存退出,执行:
pod install