title: Flutter Firebase Messaging Not working on IOS when app running in background or closed
body: <p>I have configured firebase Cloud Messaging with flutter Notification are working in foreground. but not working when running in background or app is killed.</p>
  
  <p>Following steps are done.</p>
  
  <ul>
  <li>Generated app ID and push Key in
  <a href="https://developer.apple.com/account/resources/certificates/" rel="noreferrer">https://developer.apple.com/account/resources/certificates/</a></li>
  <li>Added info.plist to ios/Runner folder</li>
  <li>Turned on Push capabilities</li>
  <li>Uploaded APNS certificate to Firebase console</li>
  <li>Added lines in AppDelegate.swift</li>
  </ul>
  
  <p>Also tried to remove following line as suggested on <a href="https://stackoverflow.com/questions/58164702/flutter-firebase-cloud-messaging-notification-when-app-in-background">Flutter Firebase Cloud Messaging - Notification when app in background</a>  but it is still not working.</p>
  
  <p>if (@available(iOS 10.0, *)) {
    [UNUserNotificationCenter currentNotificationCenter].delegate = (id) self;
   }</p>
  
  <pre><code>Flutter Doctor
  
  [✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Mac OS X 10.14.5 18F132, locale en-IN)
  
  [✗] Android toolchain - develop for Android devices
  
      ✗ Unable to locate Android SDK.
  
        Install Android Studio from: https://developer.android.com/studio/index.html
  
        On first launch it will assist you in installing the Android SDK components.
  
        (or visit https://flutter.dev/setup/#android-setup for detailed instructions).
  
        If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
  
        You may also want to add it to your PATH environment variable.
  
  
  
  [✓] Xcode - develop for iOS and macOS (Xcode 11.3)
  
  [✓] Chrome - develop for the web
  
  [!] Android Studio (not installed)
  
  [✓] Connected device (3 available)
  </code></pre>
  
  <p>One thing I noticed that , when app is installed first time it is not asking me to check if the I allow the app to send push notification.</p>
  
  <p>My code is having following lines on page after login page. </p>
  
  <pre><code>_firebaseMessaging.requestNotificationPermissions(
          const IosNotificationSettings(sound: true, badge: true, alert: true));
      _firebaseMessaging.onIosSettingsRegistered
          .listen((IosNotificationSettings settings) {
        print("Settings registered: $settings");
      });
  </code></pre>
  
  <p>Also cross checked that all following setting are ticked.</p>
  
  <p><a href="https://i.stack.imgur.com/Gvqcq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Gvqcq.png" alt="enter image description here"></a></p>