IOS 上的颤动:致命错误:未找到模块“cloud_firestore”

Lab*_*Lab 5 ios firebase flutter google-cloud-firestore

在 github 和 stack 上搜索了很长时间以查找类似错误后,没有一个建议的解决方案帮助我解决此错误。

我尝试了很多东西(有点乱):

  • 删除IOS派生数据
  • 更改 Firestore 软件包版本
  • 扑干净
  • 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 init、安装和更新
  • 取消注释平台:ios,来自 podfile 的“9.0”(可能与此问题无关)

这是错误:

    ** 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
Run Code Online (Sandbox Code Playgroud)

需要一些帮助的家伙

小智 30

对我来说,我只是将部署目标更新为与 Pod 文件中定义的相同。

请注意,您需要打开 Runner.xcworkspace 而不是 Runner.xcodeproj。

  • 这对我也有用。我在 Podfile 中修改了平台 :ios, '11.0',但忘记在 XCode 中更新它。 (2认同)

Val*_*ing 10

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

target 'Runner' do
 use_frameworks!

end
Run Code Online (Sandbox Code Playgroud)

但这是一个大问题。如果您尝试: $ rm Podfile 然后 $ pod init 将创建此 Podfile。

这是我的解决方案:

...但在此之前,您必须检查一些内容,否则我的解决方案可能不起作用:RUN:

$ pod install
Run Code Online (Sandbox Code Playgroud)

如果这个命令的结果是:

There are 0 dependencies from the Podfile and 0 total pods installed.
Run Code Online (Sandbox Code Playgroud)

您可以确定,此解决方案有效。否则它也会起作用,但也许您应该在评论中将命令行的结果写给我!!

现在回到解决方案......

  1. 步骤:使用以下代码更新您的 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
    
    Run Code Online (Sandbox Code Playgroud)

现在 Podfile 正在更新您在 podspec.yaml 文件中记录的 pod。

现在,您必须通过调用将 podspec.yaml 文件与 xcode pod 同步:

$ pod install
Run Code Online (Sandbox Code Playgroud)

然后你会看到你所有的 pod 正在下载。在此之后,您可以通过调用 flutter run 或仅在您的编辑器中运行您的 flutter 项目。

注意:Podfile.lock 文件列出了每个 Pod 的 Pod 和版本。'real' Podfile 仅用于 podspec.yaml 文件和真实 Pod 之间的连接。如果你查看你的 Podfile.lock 文件,你会看到,没有任何 pod 被写下来,这导致了问题。如果没有要安装的任何 pod,则不会找到每个模块(例如“cloud-firestore”)...

我希望这个答案对你有帮助,如果有什么不起作用,你可以在评论中问我,但我知道,这不会发生:)


jph*_*ine 6

如果您使用的是 Android Studio,如果您手动创建 Podfile,则可能会发生错误。Flutter 仅使用 pubspec.yaml 文件运行。您不必自己设置 Podfile。如果您遵循 firestore 主页上的安装指南,只需在使用 Xcode 添加 GoogleService-Info.plist 文件后跳过所有内容。


MSa*_*udi 5

嗯,就我而言,问题在于部署目标。看来默认的部署目标是,9.0而Firestore需要更高的部署目标。

我更新了我的 Podfile 平台 ios,'10.0'

同样在 Xcode 中,从运行程序项目的构建设置中,我将部署目标更改为ios 10.

这对我有用。