flutter remote push notification(fcm) not working IOS

Question

Asked by double l on November 18, 2021 (source).

  1. android works well

2.from firebase site to iOS real device works well (below this push to ios is ok) enter image description here 3. remote push from iOS to andriod works well

  1. but remote push message to iOS not working

my Xcode enter image description here

my info enter image description here

my Appdelegate.swift

import UIKit
  import Flutter
  import Firebase

   @UIApplicationMain
   @objc class AppDelegate: FlutterAppDelegate {
     override func application(
      _ application: UIApplication,
      didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey:     Any]?
    ) -> Bool {
      FirebaseApp.configure() //add this before the code below

      GeneratedPluginRegistrant.register(with: self)
      return super.application(application, didFinishLaunchingWithOptions:  launchOptions)
    }
}
 

Answer

Question answered by Shruti R (source).

Actually I had faced this issue , after long research realised that I haven't permit permission for notification, so used permission_handler plugin to ask permission for remote notification .

like this:

Future<Map<Permission, PermissionStatus>> requestPermission() async {
  Map<Permission, PermissionStatus> statuses = await [
    Permission.notification
  ].request();
  return statuses;
}
  • Uninstall the application
  • add above code
  • Call this function at starting
  • give permission
FIREBASE-CLOUD-MESSAGING FLUTTER IOS
SHARE: