首页 > 解决方案 > 未找到 CloudFirestorePlugin 文件

问题描述

运行“flutter build iOS”时出现以下问题:

'cloud_firestore/CloudFirestorePlugin.h' file not found #import <cloud_firestore/CloudFirestorePlugin.h>`

应用程序与我的 iPhone 和虚拟 iPhone 完美配合

最新版本的cocopod

代码:11.2.1

: cloud_firestore: ^0.12.10+2 //最新版本

豆荚文件

platform :ios, '13.1'

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

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

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  use_frameworks!

  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

PS。注释行被删除以使代码更短。

有谁知道这个任务有什么问题?

标签: xcodeflutter

解决方案


我得到了同样的错误。

尝试以下为我修复它的方法:

在 Xcode 中,转到 File > Workspace Settings,然后选择“Legacy Build System”

在我的 podfile 中 - 我platform :ios, '9.0'不确定你是否需要这个,但仅供参考,因为我看到你的版本是13.1

如果使用 VS Code,您可能还需要pod install从目录中的命令行运行 a <your_project_name/ios(因为 VS Code 没有正确运行/完成 pod 安装;VS Code 版本 1.40.2)

需要注意的是:我还发现初始构建 -> 在模拟器上启动,花费了 looooonnnggg 时间。我使用的是 2012 Macbook Pro,这是一个重要原因,但仅供参考。它最终确实在模拟器上启动,并且在那次热重载之后工作正常


推荐阅读