Terminating app due to uncaught exception 'NSInternalInconsistencyException' on iOS with White Screen

Viewed 1078

I'm trying to run flutter app on iOS and I get a white screen with an exception:

libc++abi: terminating with uncaught exception of type NSException

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FLTWakelockApi api doesn't respond to @selector(toggleMsg:error:)' terminating with uncaught exception of type NSException CoreSimulator 757.5 - Device: iPhone 12 Pro Max (A59923DB-2B0D-42DF-8D68-DCB8A7B7866D) - Runtime: iOS 14.5 (18E182) - DeviceType: iPhone 12 Pro Max (lldb)

This is my AppDelegate Code

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

I have tried cleaning pods Creating the app from beginning and everything like that Adding the code just like the firebase says and still get only white screen.

1 Answers

Downgrade your wakelock to version 0.5.3+3. To be safe, add it to your dependency_overrides. At the end, that section of your pubspec.yml should look like this

dependency_overrides:
  wakelock: 0.5.3+3
Related