为什么Flutter编译器告诉我我的应用程序不存在?

时间:2019-05-21 08:43:12

标签: ios firebase flutter

我正在使用Flutter制作应用程序,我需要从Firestore数据库中获取一些数据。我按照步骤将其包含在iOS Xcode项目中,但是在Xcode构建后出现错误。我什至没有在应用程序中使用Firebase。

我找到了这个答案:App getting crash when click on GoogleSignIn button

但这与我的问题不符。

这是AppDelegate.m(Xcode未报告错误):

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@import Firebase;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [GMSServices provideAPIKey:@"XXXX"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
    [FIRApp configure];
  // Override point for customization after application launch.
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end

这是我得到的错误:

Launching lib/main.dart on iPhone 8 in debug mode...
Running Xcode build...
Xcode build done.                                            7,8s
Configuring the default Firebase app...
6.0.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
6.0.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60000000 started
6.0.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see XXXX)
Configured the default Firebase app __FIRAPP_DEFAULT.
6.0.0 - [Firebase/Core][I-COR000027] The library name (flutter-firebase_core) or version number (0.4.0+1) contain invalid characters. Only alphanumeric, dash, underscore and period characters are allowed.
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f5d26fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000010eb76ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010f5d2555 +[NSException raise:format:] + 197
    3   Runner                              0x00000001076ca6b6 +[FIRApp configureWithName:options:] + 326
    4   Runner                              0x00000001076ca54f +[FIRApp configureWithOptions:] + 143
    5   Runner                              0x00000001076ca47f +[FIRApp configure] + 607
    6   Runner                              0x000000010757e61c -[AppDelegate application:didFinishLaunchingWithOptions:] + 156
    7   UIKitCore                           0x0000000119a83311 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
    8   UIKitCore                           0<…>
Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:54573/It0MI4dOUXE=/ws

这是Flutter医生的输出:

[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.4 18E226, locale fr-FR)
    • Flutter version 1.5.4-hotfix.2 at /Users/mickaeldebalme/SDK/Flutter/flutter
    • Framework revision 7a4c33425d (3 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/mickaeldebalme/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Users/mickaeldebalme/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/182.5314842/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.3)
    • Android Studio at /Users/mickaeldebalme/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/182.5314842/Android Studio.app/Contents
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] Connected device (1 available)
    • iPhone 8 • B6399A10-1F2D-44C3-8B0D-6AD086AD0F55 • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

• No issues found!

编辑 创建干净的项目后,错误仍然存​​在。 所以我做了以下事情:

  • 将我所有的插件升级到最新版本
  • 迁移到Android X
  • [FIRApp configure];移至AppDelegate.m中其余Objective-C指令的上方(是!)

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方案。 创建干净的项目后,错误仍然存​​在。所以我做了以下事情:

  • 将我所有的插件升级到最新版本
  • 迁移到Android X
  • 移动[FIRApp配置];高于AppDelegate.m中其余的Objective-C指令(是的!)