我正在开发一个Flutter 应用程序,当我运行pod install时突然得到以下错误. 我需要指出的是,我搜索了很多,try 了太多方法,但不幸的是,没有人有确切的undefined method 'each_child'错误. 我也像人们说的那样删除了Podfile.lock和Pod文件夹,并且没有再次生成:(

Error:

[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `each_child' for #<Dir:0x00007f82a354e4f8>

/Users/vahidnaghash/Developer/flutter/packages/flutter_tools/bin/podhelper.rb:50:in `block in flutter_additional_ios_build_settings'
/Users/vahidnaghash/Developer/flutter/packages/flutter_tools/bin/podhelper.rb:47:in `each'
/Users/vahidnaghash/Developer/flutter/packages/flutter_tools/bin/podhelper.rb:47:in `flutter_additional_ios_build_settings'
/Users/vahidnaghash/AndroidStudioProjects/careberry_flutter/careberry/ios/Podfile:39:in `block (3 levels) in from_ruby'
/Users/vahidnaghash/AndroidStudioProjects/careberry_flutter/careberry/ios/Podfile:38:in `each'
/Users/vahidnaghash/AndroidStudioProjects/careberry_flutter/careberry/ios/Podfile:38:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:897:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:885:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:884:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:329:in `block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:328:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:307:in `create_and_save_projects'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:299:in `generate_pods_project'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:178:in `integrate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:166:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.25.0-5.0.pre.92, on Mac OS X 10.14.6 18G103 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.1)
[✓] VS Code (version 1.49.1)
[✓] Connected device (2 available)

• No issues found!

Pods installed: (running 100)

cocoapods (1.10.0)
cocoapods-core (1.10.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.4.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-trunk (1.5.0)
cocoapods-try (1.2.0)

Podfile:

# Uncomment this line to define a global platform for your project
 platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

推荐答案

我通过在终端运行flutter channel stable,将Flutter 通道从主通道更改为稳定通道.我猜主频道有个窃听器!

Dart相关问答推荐

DART列表由以奇怪方式链接的列表(即二维数组)组成

Dart 扩展: don't access members with "this" unless avoiding shadowing

在 Dart 中处理字节数组时,使用 Uint8List 优于 List 有什么优势?

如何在 Dart 中创建画布元素?

如何在Flatter中更改复选框边框 colored颜色 ?默认情况下,它显示为黑色,但我希望它显示为灰色

判断 Future 是否完整

如何在flatter中使用SQFlite更新数据库表

Flutter中图像纵横比的变化

如何在Flatter中的屏幕中心创建选项卡栏?

如何在Flatter dart中使用相同的元素初始化列表?

在 Dart 中使用带有 Future 的循环

从Dart中的另一个文件导入扩展名方法

Dart:默认 gitignore?

如何减少 ListView.builder 中 RaisedButton 的宽度?

在 Dart 中修改类内的最终字段

Dart:实例变量在私有类中应该是私有的还是公共的?

dart 如何创建、监听和发出自定义事件?

有可用的 Dart VM 吗?

如何在 Dart 中执行相当于 setTimeout + clearTimeout 的操作?

Dart MD5 字符串