【问题标题】:Several errors running Flutter project on iOS simulator在 iOS 模拟器上运行 Flutter 项目的几个错误
【发布时间】:2019-09-07 16:32:14
【问题描述】:

我正在开发一个 Flutter 项目,它一直运行良好,直到两周前我升级了包的版本以与 androidX 兼容。从那以后我遇到了一些我已经解决的错误,但从昨天开始我一直被困在我似乎无法解决的同一个错误上。

现在,每当我尝试在 iOS 上运行项目时,项目都会构建,但是当它即将启动时,模拟器会冻结,并且我会收到以下错误输出:

2019-04-17 13:56:20.283677+0200 Runner[21883:6267368]  - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2019-04-17 13:56:20.294070+0200 Runner[21883:6266945] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
2019-04-17 13:56:20.425242+0200 Runner[21883:6266945] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
2019-04-17 13:56:20.425387+0200 Runner[21883:6266945] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2019-04-17 13:56:20.426345+0200 Runner[21883:6266945] Configuring the default Firebase app...
2019-04-17 13:56:20.426395+0200 Runner[21883:6267384] 5.20.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
2019-04-17 13:56:20.477082+0200 Runner[21883:6267383] 5.20.0 - [Firebase/Analytics][I-ACS023007] Analytics v.50801000 started
2019-04-17 13:56:20.479725+0200 Runner[21883:6267383] 5.20.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see *url*)
2019-04-17 13:56:20.484815+0200 Runner[21883:6266945] Configured the default Firebase app __FIRAPP_DEFAULT.
2019-04-17 13:56:20.530844+0200 Runner[21883:6267409] flutter: Observatory listening on http://127.0.0.1:54881/
2019-04-17 13:56:21.026177+0200 Runner[21883:6267427] 5.20.0 - [Firebase/Core][I-COR000004] App with name (null) does not exist.
2019-04-17 13:56:21.027251+0200 Runner[21883:6267382] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fcd6740e330] get output frames failed, state 8196
2019-04-17 13:56:21.027450+0200 Runner[21883:6267382] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fcd6740e330] get output frames failed, state 8196
2019-04-17 13:56:21.028091+0200 Runner[21883:6267382] TIC Read Status [1:0x0]: 1:57
2019-04-17 13:56:21.028235+0200 Runner[21883:6267382] TIC Read Status [1:0x0]: 1:57
2019-04-17 13:56:21.073087+0200 Runner[21883:6266945] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: 0)'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001151ed1bb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000011478b735 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001151394ec _CFThrowFormattedException + 194
    3   CoreFoundation                      0x000000011525f396 -[__NSDictionaryM setObject:forKey:] + 1046
    4   Runner                              0x00000001101ceb34 -[FLTFirebaseAuthPlugin handleMethodCall:result:] + 15636
    5   Flutter                             0x00000001118ac7ba __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 115
    6   Flutter                             0x00000001118c94ac _ZNK5shell21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrIN5blink15PlatformMessageEEE + 166
    7   Flutter                             0x00000001118ccff0 _ZN5shell15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrIN5blink15PlatformMessageEEE + 38
    8   Flutter                             0x000000011191fca7 _ZNSt3__110__function6__funcIZN5shell5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrIN5blink15PlatformMessageEEEE4$_27NS_9allocatorIS9_EEFvvEEclEv + 57
    9   Flutter                             0x00000001118d8e0e _ZN3fml15MessageLoopImpl15RunExpiredTasksEv + 522
    10  Flutter                             0x00000001118dc18c _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26
    11  CoreFoundation                      0x0000000115152f34 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    12  CoreFoundation                      0x0000000115152b32 __CFRunLoopDoTimer + 1026
    13  CoreFoundation                      0x000000011515239a __CFRunLoopDoTimers + 266
    14  CoreFoundation                      0x000000011514ca1c __CFRunLoopRun + 2252
    15  CoreFoundation                      0x000000011514be11 CFRunLoopRunSpecific + 625
    16  GraphicsServices                    0x00000001196931dd GSEventRunModal + 62
    17  UIKitCore                           0x000000011dcf981d UIApplicationMain + 140
    18  Runner                              0x000000010fcd7c04 main + 68
    19  libdyld.dylib                       0x0000000116a2a575 start + 1
    20  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

在我看来有几个错误,但我不知道其中一些只是警告还是实际错误。我认为问题/问题与 firebase_auth、firebase_core 或其他插件有关。

pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  cloud_firestore: ^0.9.0
  firebase_analytics: ^2.0.0
  rxdart: ^0.19.0
  cached_network_image: ^0.5.1
  firebase_auth: ^0.8.0
  intl: ^0.15.7               
  http: ^0.12.0
  shared_preferences: ^0.4.3
  share: ^0.5.3
  flutter_webview_plugin: ^0.3.1
  mailer: ^2.1.2
  flutter_launcher_icons: ^0.7.0
  package_info: ^0.4.0
  flutter_circular_chart: ^0.1.0
  dots_indicator: ^0.0.4
  url_launcher: 4.2.0+1
  webview_flutter: ^0.3.4
  connectivity: ^0.4.2
  vibrate: ^0.0.4
  devicelocale: ^0.1.1
  firebase_core: ^0.3.0

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

【问题讨论】:

    标签: ios firebase flutter


    【解决方案1】:

    通过创建一个新的flutter项目并将所有文件复制到那里来解决。

    我从来没有弄清楚问题出在哪里。

    【讨论】:

      【解决方案2】:

      你有答案:

      2019-04-17 13:56:21.073087+0200 Runner[21883:6266945] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“* -[__NSDictionaryM setObject:forKey: ]: 对象不能为 nil (key: 0)'

      您尝试在字典中插入 nil 并且调用来自 [FLTFirebaseAuthPlugin handleMethodCall:result:]

      似乎找不到 Firebase 凭据。

      【讨论】:

      • 是的,你是绝对正确的,它试图在字典中插入 tnil。您能否解释一下您是如何得出这是由于 Firebase 凭据而得出的结论?我不明白
      • 仔细检查firebase GoogleService-Info.plist 并检查项目是否可以成功读取它。路径应该是 ios/Runner/GoogleService-Info.plist
      • 感谢您的帮助。我刚刚重新下载了 GoogleService-Info.plist 文件,它位于正确的位置。我仍然得到同样的错误:(
      猜你喜欢
      • 2021-12-22
      • 1970-01-01
      • 2021-08-31
      • 1970-01-01
      • 2020-10-24
      • 2021-06-27
      • 2020-07-18
      • 2022-09-28
      • 2018-12-14
      相关资源
      最近更新 更多