Cocoapods 错误,而 运行 ios 应用导致 pod 安装错误

Cocoapods error while running ios app which leads error in pod install

我正在尝试同时创建 ios 和 android 应用程序,它适用于 android 但适用于 ios 而 运行 flutter run 使用pod install安装pod会花很多时间,最后会报错如下图

Error output from CocoaPods:
↳
         Cloning into
         '/var/folders/f6/g4njsx3x5tx5dswcbsh29tdh0000gn/T/d20210605-16785-1rc0t
         ko'...
         fatal: unable to access 'https://github.com/grpc/grpc.git/': Failed to
         connect to github.com port 443: Connection refused
Error running pod install
Error launching application on iPhone 12 Pro Max.

我尝试了这些帖子,但没有成功
error running pod install
error running pod install pods-runner


pubsec.yaml

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  image_picker: ^0.6.7+17
  firebase_ml_vision: ^0.9.10
  image_cropper: ^1.4.0
  firebase_core: ^0.3.4
  cloud_firestore: ^0.9.13+1
  expandable: ^5.0.1
  web_scraper:

如果需要任何额外信息,请在评论中告诉我

经过多次研究,我找到了解决方案,

第 1 步:我使用

删除了所有 cocoapods 及其目录
gem list --local | grep cocoapods
sudo gem uninstall EACH_OF_THEM  // here EACH_OF_THEM means all the listed cocoapods
rm -rf ~/.cocoapods

第 2 步:安装 HomeBrew

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

第 3 步:使用 HomeBrew 安装 cocoapods

brew install cocoapods

第 4 步:删除 Podfile.lock(如果存在)

cd ios
rm Podfile.lock

第 5 步:现在安装 pod

pod install --repo-update

It will take lot of time to download and install all the dependencies.

现在,如果我 运行 flutter 项目使用 flutter run。成功了

...
Running pod install...
Running Xcode build...
...

参考 link : dev.to