gpt4 book ai didi

ios - IOS : fatal error: module 'cloud_firestore' not found 上的 flutter

转载 作者:行者123 更新时间:2023-12-03 19:41:10 35 4
gpt4 key购买 nike

在 github 和 stack 上搜索了很长时间以查找类似错误后,没有一个建议的解决方案可以帮助我解决此错误。
我尝试了很多东西(有点乱):

  • 删除 IOS 派生数据
  • 更改 Firestore 软件包版本
  • flutter 干净
  • rm -Rf ios/Pods
  • rm -Rf ios/.symlinks
  • rm -Rf ios/Flutter/Flutter.framework
  • rm -Rf ios/Flutter/Flutter.podspec
  • rm -rf ios/Podfile ios/Podfile.lock ios/Pods ios/Runner.xcworkspace
  • pod 初始化、安装和更新
  • 取消注释平台 :ios, '9.0' from podfile (可能没有链接到这个问题)

  • 这是错误:
        ** BUILD FAILED **


    Xcode's output:

    /Users/flo/Mobile/we_ll_see/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module
    'cloud_firestore' not found
    @import cloud_firestore;
    ~~~~~~~^~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    需要一些帮助

    最佳答案

    这是一个非常糟糕和不幸的错误。在尝试解决这个问题几个小时后,我终于找到了解决方案。问题是,您的 Podfile 没有使用 pubspec.yaml 文件进行更新。我认为,您的 Podfile 几乎是空的:

    target 'Runner' do
    use_frameworks!

    end
    但这是个大问题。如果您尝试: $ rm Podfile 然后 $ pod init 将创建此 Podfile。
    这是我的解决方案:
    ...但在此之前,您必须检查一些内容,否则我的解决方案可能无法正常工作:
    跑:
    $ pod install
    如果此命令的结果是:
    There are 0 dependencies from the Podfile and 0 total pods installed.
    您可以肯定,此解决方案有效。否则它也会起作用,但也许你应该在评论中写下你的命令行结果!
    现在回到解决方案...
  • 步骤:使用以下代码更新您的 Podfile(请删除文件的旧内容):
     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

  • Now the Podfile is updating the pods you wrote down in your podspec.yaml file.


    现在您必须通过调用将 podspec.yaml 文件与 xcode pod 同步:
    $ pod install
    然后你会看到你所有的 pod 都在下载。在此之后,您可以通过调用 flutter run 或仅在您的编辑器中运行您的 Flutter 项目。
    注意:Podfile.lock 文件列出了 pod 和每个 pod 的版本。 'real' Podfile 仅用于 podspec.yaml 文件和真实 pod 之间的连接。如果您查看您的 Podfile.lock 文件,您会看到,没有任何 pod 被记录下来,这就是问题所在。如果没有要安装的 pod,则不会找到每个模块(例如“cloud-firestore”)...
    我希望这个答案对您有所帮助,您可以在评论中问我是否有问题,但我知道,这不会发生:)
    为 macOS 编辑:
    platform :osx, '10.11'
    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', 'ephemeral',
    '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 Flutter-
    Generated.xcconfig, then run \"flutter pub get\""
    end

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

    flutter_macos_podfile_setup

    target 'Runner' do
    use_frameworks!
    use_modular_headers!

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

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

    关于ios - IOS : fatal error: module 'cloud_firestore' not found 上的 flutter ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64362285/

    35 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com