I am adding the flutter_local_notification to my app and I am having this problem on iOS where when the app starts it crashes when trying to call the FlutterLocalNotificationsPlugin.setPluginRegistrantCallback
from the app delegat's didFinishLaunchingWithOptions
this is my app delegate:
import UIKit
import Firebase
import Flutter
import flutter_local_notifications
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
//GeneratedPluginRegistrant.register(with: self)
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
GeneratedPluginRegistrant.register(with: registry)
}
GeneratedPluginRegistrant.register(with: self)
if #available(iOS 10.0, *){
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
I have tried to find if anyone had the same problem, I have seen some loosely related problems but nothing that fixes the problem. This normally should work as stated in the flutter_local_notifications documentation on pub.dev.
flutter_local_notification seems to be using file_picker and my project was already using an older version. updating my pubspec.yaml to use the current version (file_picker: ^8.0.0+1) fixed the problem.