【发布时间】:2021-11-10 19:07:04
【问题描述】:
我正在尝试在 iOS 上运行 Flutter 应用,但出现白屏异常:
libc++abi: terminating with uncaught exception of type NSException
*** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“FLTWakelockApi api 不响应 @selector(toggleMsg:error:)” 以 NSException 类型的未捕获异常终止 CoreSimulator 757.5 - 设备:iPhone 12 Pro Max (A59923DB-2B0D-42DF-8D68-DCB8A7B7866D) - 运行时:iOS 14.5 (18E182) - 设备类型:iPhone 12 Pro Max (lldb)
这是我的 AppDelegate 代码
import UIKit
import Flutter
import GoogleMaps
import Firebase
import UserNotifications
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// TODO 1.4 - Shipping Address - Google API Key ????
GMSServices.provideAPIKey("AIzaSyDnBpxFOfeG6P06nK97hMg01kEgX48JhLE")
GeneratedPluginRegistrant.register(with: self)
if #available(iOS 10.0, *) {
application.applicationIconBadgeNumber = 0 // Clear Badge Counts
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// Pass device token to auth
Auth.auth().setAPNSToken(deviceToken, type: .prod)
super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}
override func application(_ application: UIApplication,
didReceiveRemoteNotification notification: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
if Auth.auth().canHandleNotification(notification) {
completionHandler(.noData)
return
}
super.application(application, didReceiveRemoteNotification: notification, fetchCompletionHandler: completionHandler)
}
override func application(_ application: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
if Auth.auth().canHandle(url) {
return true
}
return super.application(application, open: url, options: options)
}
}
Please check image which shows error in AppDelegate
我尝试过清洁豆荚 从头开始创建应用程序以及类似的一切 就像 firebase 说的那样添加代码,仍然只能得到白屏。
【问题讨论】:
-
检查这是否回答了您的问题github.com/Sub6Resources/flutter_html/issues/843
-
您在“异常”上设置了一个断点,这样您就可以进行调试,并且您的程序将在抛出异常时停止。
标签: ios firebase flutter appdelegate