运行 ios 应用程序时出现 Cocoapods 错误,导致 pod 安装出错

时间:2021-06-05 19:12:22

标签: ios flutter dart cocoapods flutter-dependencies

我正在尝试创建 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 个答案:

答案 0 :(得分:0)

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

第 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
<块引用>

下载和安装所有依赖项需要很多时间。

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

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

引用链接:dev.to