I am setting up fcm with a flutter app and using local notifications to show notifications when the app is in foreground .
in android it works perfectly with no errors whatsoever . But on IOS local notifications are not working . its not showing an error or anything but when the app is in the foreground its now showing the notification banner at all
this is the setup for local notification :
var android = AndroidInitializationSettings('mipmap/ic_launcher');
var ios = IOSInitializationSettings();
var platform = new InitializationSettings(android, ios);
flutterLocalNotificationsPlugin.initialize(platform);
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(sound: true, badge: true, alert: true, provisional: false));
Then there is the showNotification function which is this :
showNotification(Map<String, dynamic> message) async {
var android = new AndroidNotificationDetails(
'IMPORTANT1', 'SHOW BANNER', 'ALWAYS SHOWS BANNER',
importance: Importance.Max, priority: Priority.High, ticker: 'ticker');
var ios = new IOSNotificationDetails();
var platform = NotificationDetails(android, ios);
await flutterLocalNotificationsPlugin.show(
0,
message['notification']['title'],
message['notification']['body'],
platform); }
i have searched through the internet and found out i need to use this
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
and i added it to AppDelegate.swift but still not working
thanks