【问题标题】:Flutter - iOS debugging crashesFlutter - iOS 调试崩溃
【发布时间】:2020-02-15 09:27:57
【问题描述】:

我正在使用 VS CodeiPhone 5s 上调试我的颤振应用,但它崩溃了,我不知道如何解决这个错误:

Launching lib/main.dart on iPhone 5s in debug mode...
Running pod install...                                              40.7s
Running Xcode build...                                                  
(This is taking an unexpectedly long time.)                                     
 ├─Assembling Flutter resources...                          58.7s
 └─Compiling, linking and signing...                       102.4s
Xcode build done.                                           524.6s
Configuring the default Firebase app...
*** First throw call stack:
(
        0   CoreFoundation                      0x000000011408d1bb __exceptionPreprocess + 331
        1   libobjc.A.dylib                     0x000000011362b735 objc_exception_throw + 48
        2   CoreFoundation                      0x000000011408d015 +[NSException raise:format:] + 197
        3   Runner                              0x000000010f3b125a +[FIRApp configure] + 138
        4   Runner                              0x000000010f5837d9 -[FLTFirebaseAnalyticsPlugin init] + 217
        5   Runner                              0x000000010f58360d +[FLTFirebaseAnalyticsPlugin registerWithRegistrar:] + 173
        6   Runner                              0x000000010f34d81e +[GeneratedPluginRegistrant registerWithRegistry:] + 126
        7   Runner                  <…>

PS:在 Flutter 之前我是原生 Android 开发者,所以我不知道如何调试 iOS

我在 Windows 10 上使用 Virtualbox 在 macOS Mojave 10.14.3 上构建 iOS 应用程序

这是我的flutter doctor -v 结果:

[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.14.3 18D109, locale en-US)
    • Flutter version 1.9.1+hotfix.4 at /Users/salah/development/flutter
    • Framework revision cc949a8e8b (3 weeks ago), 2019-09-27 15:04:59 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.


 
[✓] Xcode - develop for iOS and macOS (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • CocoaPods version 1.7.5

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • iPhone 5s • D5C44375-4AD0-499F-891B-A2CE044C2EA4 • ios • iOS 12.1 (simulator)

! Doctor found issues in 2 categories.

【问题讨论】:

  • 我的应用在安卓设备上运行良好。
  • 如果你进入命令行,导航到你的项目文件夹,然后输入flutter build ios -v,它会返回什么?
  • 这是由 Firebase 配置导致的崩溃。如果您使用为 Android 生成的 .json 文件配置 Firebase,您还需要为 iOS 添加等效的 .plist 文件。您还可以通过 dart 以编程方式配置 Firebase,不需要任何其他文件。
  • 哦,谢谢@danypata,它运行良好,我的应用现在可以 100% 运行!

标签: ios xcode flutter


【解决方案1】:

您仅在以下位置添加了google-services.json 用于 Android 的 Firebase 配置文件:

android > app > google-services.json

您需要为 iOS Firebase 配置添加 GoogleService-Info.plist 文件:

ios > Runner > GoogleService-Info.plist

【讨论】:

  • @danypata 之前在 cmets 中回答过,但你是绝对正确的。
猜你喜欢
  • 2022-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-07
  • 1970-01-01
  • 1970-01-01
  • 2020-08-20
  • 2022-07-03
相关资源
最近更新 更多