ios - Flutter 启动 iOS 应用程序时显示黑屏

标签 ios firebase flutter

问题:在正确执行操作后,我的 iOS Flutter 应用出现黑屏 构建(XCode 或 VSCode 或 Android Studio),没有错误。立刻 它安装并启动后屏幕变黑,没有任何其他生命迹象。 该应用程序已生成(我可以在屏幕上看到该图标),但一旦我 启动应用程序,它完全变黑。

设置:(请参阅下面的 Flutter doctor)我正在将 Flutter 与 Firebase 结合使用 iOS 物理设备中的数据库(也在各种模拟器类型中)。 重要:同样的代码在Android上运行正常,没有黑屏 屏幕,一切正常!

我很确定我的 Firebase 中的所有内容都已正确配置 项目中,我一直在检查每一个细节,正如我所说,当 启动到 Android 设备,一切正常。对于 iOS 来说 文件 GoogleService-Info.plist 位于其位置。 XCode 中的签名配置也已完成,并且没有错误。

输出.-

flutter 医生-v

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2
19C57, locale es-ES)
    • Flutter version 1.12.13+hotfix.5 at /Users/desarrollo/development/flutter
    • Framework revision 27321ebbad (2 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/desarrollo/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native
profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • C9503E12-9146-452B-93AE-E31DBEA1097E • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

• No issues found!

pubspec.yaml(假设正确的表格):

name: tumeteo_app
description: A new Flutter project.

version: 1.0.0+1

environment:
sdk: ">=2.2.2 <3.0.0"

dependencies:
flutter:
sdk: flutter
firebase_core: ^0.4.3+1
firebase_storage: ^3.1.0
firebase_storage_image: ^0.4.0
cloud_firestore: ^0.13.0+1
firebase_auth: ^0.15.3
curved_navigation_bar: ^0.3.1
carousel_pro: ^1.0.0
firebase_messaging: ^6.0.9
rflutter_alert: ^1.0.3
shared_preferences: ^0.5.6

image_cropper: ^1.1.0
image_picker: ^0.6.2+1

cupertino_icons: ^0.1.2

dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.7.4

flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon3.png"
adaptative_icon_background: "assets/icon/icon3.png"

flutter:
uses-material-design: true
assets:
- assets/images/

fonts:
- family: PermanentMarker
fonts:
- asset: fonts/PermanentMarker-Regular.ttf
- family: BarlowCondensed
fonts:
- asset: fonts/BarlowCondensed-Regular.ttf
- family: Handlee
fonts:
- asset: fonts/Handlee-Regular.ttf
- family: PathwayGothicOne
fonts:
- asset: fonts/PathwayGothicOne-Regular.ttf
- family: RopaSans
fonts:
- asset: fonts/RopaSans-Regular.ttf

Xcode 构建的输出:

2019-12-27 11:02:51.658802+0100 Runner[11289:50522]  -
<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-12-27 11:02:51.981673+0100 Runner[11289:49976]
[VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache,
aborting restore
2019-12-27 11:02:51.984084+0100 Runner[11289:49976] Configuring the
default Firebase app...
2019-12-27 11:02:51.997756+0100 Runner[11289:50520] 6.14.0 -
[Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not
exist.
2019-12-27 11:02:52.088688+0100 Runner[11289:50521] 6.14.0 -
[Firebase/Analytics][I-ACS023007] Analytics v.60107000 started
2019-12-27 11:02:52.089771+0100 Runner[11289:50521] 6.14.0 -
[Firebase/Analytics][I-ACS023008] To enable debug logging set the
following application argument: -FIRAnalyticsDebugEnabled 
2019-12-27 11:02:52.111059+0100 Runner[11289:49976] Configured the
default Firebase app __FIRAPP_DEFAULT.
2019-12-27 11:02:52.226945+0100 Runner[11289:50556] 6.14.0 -
[Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications
proxy enabled, will swizzle remote notification receiver handlers. If
you'd prefer to manually integrate Firebase Messaging, add
"FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to
NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.

VSCode 的输出:

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done. 570,6s
path: satisfied (Path is satisfied), interface: en0
[VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache,
aborting restore
Configuring the default Firebase app...
path: satisfied (Path is satisfied), interface: en0
Configured the default Firebase app __FIRAPP_DEFAULT.
path: satisfied (Path is satisfied), interface: en0
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.

最佳答案

应用抛出一条消息名为 __FIRAPP_DEFAULT 的应用不存在。 - 当 Firebase 未在 Flutter 应用中正确初始化时,通常会出现此错误。在 Flutter 应用的 main.dart 中导入包并初始化 Firebase

import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';

...

await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

您可以关注此guide了解更多详情。

关于ios - Flutter 启动 iOS 应用程序时显示黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59499847/

相关文章:

ios - iOS 是否保证是小端?

ios - 需要在 UIActivitycontroller 中显示腾讯微博图标

flutter - Flutter:使用扩展

list - 我怎样才能找到一个列表包含在任何元素中的另一个列表?

ios - 如何为我的 iOS Cocos2d 游戏保存游戏数据?

ios - 为 iOS 8 构建 Firebase 支持的应用程序时出现链接错误

android - Firebase 云消息传递不同的 key

ios - 主题未在 Firebase 通知中创建?

rest - 为什么flutter拒绝在本地主机上连接:8000 or 127. 0.01 :8000?

ios广告sdk?