Xcode构建失败,严重错误:找不到模块'firebase_auth'@import firebase_auth;

时间:2020-06-25 22:47:58

标签: ios xcode macos flutter cocoapods

    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?

4 个答案:

答案 0 :(得分:1)

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

  2. 根据您要归档的内容,删除Podfile中的最后3行,或者在“ use_modular_headers!”之后紧接将行“ pod'AFNetworking','〜> 3.0'”定位到目标“ Runner”!

  3. 在左侧边栏中打开XCode最上端项目(蓝色图标)->在最左侧菜单中,您将看到两个部分-Project和Targets。因此,位于“目标”块中的名称是唯一在关键字“目标”之后出现在Podfile中的名称

  4. 一切取决于:

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

答案 1 :(得分:1)

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

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

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

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

答案 2 :(得分:0)

更新:通过执行以下操作,我最终找到了解决方法:

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

似乎与Runner.xcworkspace文件夹和内部版本有关 运行构建所需的文件。

答案 3 :(得分:0)

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