【问题标题】:Flutter app not running or building on IOS EmulatorFlutter 应用程序未在 IOS 模拟器上运行或构建
【发布时间】:2021-05-27 03:38:29
【问题描述】:

这是我第一次使用 StackOverflow 来解决实际问题,所以在此先感谢。

我开始使用 Flutter 构建应用程序(最初仅适用于 Andoid),我非常喜欢它。

完成我的应用并将其部署到 Google Play 商店后,我给自己买了一台 Macbook,我正在尝试使用该 Flutter 代码并将其发布到 App Store。

我的程序正在使用 Firebase,我很确定错误是造成它的原因,但不幸的是我无法找到或修复它。

我已经做了什么? 我为 IOS 完成了完整的 Firebase 设置,这意味着下载 google 服务文件并将其放在 xcode 中的第一个 Runner 部分。

我还设置了 firebase 告诉我的其余部分。 (吊舱安装等)

该应用在 Android Emulator 上运行良好,但在 IOS Emulator 上无法启动。

我正在使用 VSCode。

在代码本身我没有任何错误。

我还将 Pod(第一行)中的最低版本更改为 10.12。否则我无法加载这些必要的 pod。

构建错误代码:

Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
 lib/main.dart
Xcode build done.                                           346,1s
Failed to build iOS app
Error output from Xcode build:
↳
    * BUILD FAILED *
Xcode's output:
↳
    While building module 'firebase_core' imported from /usr/local/Caskroom/flutter/1.22.6/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.16.0/ios/Classes/FLTTransactionStreamHandler.m:6:
    In file included from <module-includes>:1:
    In file included from /Users/fabianschimpfhauser/Desktop/WhoWouldrather/whowouldrather/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
    In file included from //usr/local/Caskroom/flutter/1.22.6/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/ios/Classes/FLTFirebaseCorePlugin.h:11:
    //usr/local/Caskroom/flutter/1.22.6/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/fabianschimpfhauser/Desktop/WhoWouldrather/whowouldrather/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
    #import <FirebaseCore/FirebaseCore.h>
            ^
    1 error generated.
    /usr/local/Caskroom/flutter/1.22.6/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.16.0/ios/Classes/FLTTransactionStreamHandler.m:6:9: fatal error: could not build module 'firebase_core'
    #import <firebase_core/FLTFirebasePluginRegistry.h>
     ~~~^
    2 errors generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'leveldb-library' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'shared_preferences' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'in_app_purchase' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'abseil' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'BoringSSL-GRPC' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'gRPC-Core' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'gRPC-C++' from project 'Pods')
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Exited (sigterm)

编辑:添加截图

Screenshot from Flutter Doctor

编辑2: Screenshot from X-Code Builder ErrorLog

【问题讨论】:

    标签: ios xcode firebase flutter


    【解决方案1】:

    所以,我的假设是:

    1 错误:我们可以看到 Firebase 包的一些错误,但它不应该影响模拟器 2 错误:这似乎是你痛苦的主要原因 警告:签名和功能的功能可能无法正常运行,因为其权利使用占位符团队 ID。要解决此问题,请在 Runner 编辑器中选择一个开发团队。 (在项目“Runner”的目标“Runner”中)

    这意味着你必须在代码中打开你的项目并尝试这个解决方案:

    转到 Xcode 首选项 -> 帐户并登录到您的 Apple 帐户,然后转到您的 Xcode 项目和签名和功能并选择您的帐户。

    【讨论】:

    • 您还可以在此处找到更多信息:developer.apple.com/documentation/xcode/…
    • 感谢您的回答。我试过了,但不幸的是这不是原因。我确实尝试在 XCode 中运行它,并且出现了更具体的错误消息。我将使用更新编辑我上面的问题
    猜你喜欢
    • 1970-01-01
    • 2021-06-07
    • 1970-01-01
    • 2021-09-21
    • 1970-01-01
    • 2021-07-30
    • 2021-08-08
    • 2021-01-15
    • 2023-03-07
    相关资源
    最近更新 更多