Xcode Build failed,fatal error: module 'firebase_auth' not found @import firebase_auth;

Xcode Build failed,fatal error: module 'firebase_auth' not found @import firebase_auth;

    Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.5 19F101, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.46.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

\\\错误信息

     ** BUILD FAILED **
Xcode's output:
↳
    /Users/Razi/Desktop/projects/Sayy/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'firebase_auth' not found
    @import firebase_auth;
     ~~~~~~~^~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

我尝试删除 Podfile/Podlock 和 运行 pod init/ pod install 但没有成功。还查看了 ios 文件夹的 GitHub 存储库。为什么找不到 firebase_auth?

  1. 您似乎没有提供完整的 Podfile 内容(我在那里看不到任何关于 Sayy 目标的信息)或者您一直在更改 Podfile

  2. 根据您尝试归档的内容,删除 Podfile 中的最后 3 行或将行“pod 'AFNetworking', '~> 3.0'” 移动到目标 'Runner' 之后'use_modular_headers!'

  3. 打开 XCode 左侧栏中最上面的项目(蓝色图标)-> 在最左侧的菜单中,您将看到两个部分 — 项目和目标。因此 'targets' 块中的名称是唯一可以在关键字 'target'

    之后出现在 Podfile 中的名称
  4. 一切取决于:

  • 您需要 AFNetworking 吗?
  • 您的应用程序中有哪些目标

更新:我最终通过执行以下命令找到了解决方法:

  1. 运行 Flutter Clean(在项目的 ios 文件夹中)
  2. 同时删除 PodlockPod Folder
  3. 运行 pod init 后跟 pod install

似乎是 runner.xcworkspace 文件夹和构建的问题 运行 构建所需的文件。

我尝试按照建议的步骤执行 Flutter clean,手动删除 podfilepodfile.lock 以及 Pod 相关文件夹,再次执行 pod install,等等 - 没有任何帮助。

最终帮助我的是以下序列:

  1. 使用 pubspec.yaml 中声明的相同依赖项创建一个新项目。
  2. 运行 pub get 在新项目中。
  3. 运行pod install在新项目中生成所有内容
  4. 将新生成的 podfilepodfile.lock 文件复制到旧项目。
  5. 运行 pod install 在旧项目中。

只有在这个序列之后我才能再次构建 iOS 项目。

These steps helped me to resolve the issue completely for IOS:
>> flutter clean
 then "delete podfile, podfile.lock, pod folder"
>> flutter pub get
>> pod install
>> flutter run

在构建设置中更改 ios 的部署目标 -> xcode 中的部署或在 podfile 中设置部署目标大于 10

我已经解决了这个问题,购买取消注释 Podfile 中的行

 platform :ios, '10.0'

同时删除清理您的项目并重新重建!

这是对我有用的方法

  1. 在 pub.dev
  2. 上查找 firebase_core / firebase_auth 的最新版本
  3. 清除 ios 文件夹中的 Pods/Podfile.lock
  4. 运行 pod install --repo-updateios 文件夹中(重要!)