Flutter 应用程序未在 IOS 模拟器上运行或构建

时间:2021-02-24 19:07:22

标签: ios xcode firebase flutter

这是我第一次使用 StackOverflow 解决实际问题,所以提前致谢。

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

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

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

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

我也确实设置了 firebase 告诉我的其余部分。 (pod 安装等)

该应用在 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

1 个答案:

答案 0 :(得分:0)

所以,我的假设是:

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

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

<块引用>

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