今天在开始学习flutter的过程中安装环境遇到CocoaPods installed but not initialized.这个问题。如下:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.7.1, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 10.2.1)
✗ CocoaPods installed but not initialized.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your
plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To initialize CocoaPods, run:
pod setup
once to finalize CocoaPods' installation.
[✓] iOS tools - develop for iOS devices
[✓] Android Studio (version 3.4)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
但是在我的Mac上的确装过cocoapods为啥说没有初始化呢,于是乎查了很多资料,发现是cocospods的master没有下载下来于是就去做了下载,下载之前需要先将目录切换到~/.cocoapods/repos下,如下
git clone https://github.com/CocoaPods/Specs.git master
然后执行
pod setup
然后就解决了这个问题,下载过程会很慢,经过研究有提升速度的方法如链接:
https://www.liuandy.cn/git/2019/11/28/2882.html
一定注意在设置完hosts文件后不要进行dns刷新了,刷新后IP又变了之前的设置就没意义了。