执行flutter doctor出现Warning: CocoaPods installed but not initialized 问题,然后提示我们去执行: sudo gem install cocoapods
安装cocoapods过程失败,发现原因是:
Unable to download data from https://gems.ruby-china.org/ - bad response Not Found 404
解决方法:
一、首先查看一下自己的ruby,看是不是 https://gems.ruby-china.com/
gem sources -l
二、如果不是 https://gems.ruby-china.com/ 的源的话,就添加新源,卸载旧源;
gem sources --add https://gems.ruby-china.com/ --remove https://gems.ruby-china.org/
三、再次查看自己的ruby,看是否替换成功。如果显示是https://gems.ruby-china.com/则说明替换成功。
gem sources -l
四、重新执行。
sudo gem install cocoapods