Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    Setting Up a Google Colab AI-Assisted Coding Environment That Actually Works

    March 11, 2026

    The economics of enterprise AI: What the Forrester TEI study reveals about Microsoft Foundry

    March 11, 2026

    The search for new bosons beyond Higgs – Physics World

    March 11, 2026
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»flutter – Firebase Cloud Messaging notifications work in Debug but not in Release mode on iOS
    iOS Development

    flutter – Firebase Cloud Messaging notifications work in Debug but not in Release mode on iOS

    big tee tech hubBy big tee tech hubAugust 5, 2025003 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    flutter – Firebase Cloud Messaging notifications work in Debug but not in Release mode on iOS
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    Problem Description

    I have a Flutter app with Firebase Cloud Messaging (FCM) that works perfectly in Debug mode but fails to display notifications visually in Release mode on iOS. Here’s what happens:

    • ✅ Debug mode: Notifications appear correctly when app is closed/background
    • ❌ Release mode: Notifications are received by the app (status 200) but never displayed visually when app is closed/background
    • ✅ Firebase Console: Notifications sent directly from Firebase Console work perfectly in both modes
    • ✅ App foreground: Notifications work in both Debug and Release when app is open

    Current Configuration

    iOS AppDelegate.swift

    import UIKit
    import Flutter
    import Firebase
    import UserNotifications
    import FirebaseMessaging
    
    @main
    @objc class AppDelegate: FlutterAppDelegate {
      override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
      ) -> Bool {
        FirebaseApp.configure()
    
        if #available(iOS 10.0, *) {
          UNUserNotificationCenter.current().delegate = self
          let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
          UNUserNotificationCenter.current().requestAuthorization(
            options: authOptions,
            completionHandler: { granted, error in
              print("🔔 Notification permission: \(granted)")
            })
        }
        
        application.registerForRemoteNotifications()
        GeneratedPluginRegistrant.register(with: self)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
      }
    
      override func application(_ application: UIApplication,
                              didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        print("�� APNs device token: \(deviceToken.map { String(format: "%02.2hhx", $0) }.joined())")
        Messaging.messaging().apnsToken = deviceToken
      }
    
      override func application(
        _ application: UIApplication,
        didReceiveRemoteNotification userInfo: [AnyHashable: Any],
        fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
      ) {
        print("📱 Notification received in background: \(userInfo)")
        completionHandler(.newData)
      }
    
      override func userNotificationCenter(
        _ center: UNUserNotificationCenter,
        willPresent notification: UNNotification,
        withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
      ) {
        if #available(iOS 14.0, *) {
          completionHandler([.banner, .sound, .badge])
        } else {
          completionHandler([.alert, .sound, .badge])
        }
      }
    }
    

    Info.plist

    UIBackgroundModes
    
        fetch
        remote-notification
    
    FirebaseAppDelegateProxyEnabled
    
    

    Runner.entitlements

    aps-environment
    production
    

    Firebase Function (Node.js)

    const message = {
      token: token,
      notification: {
        title: title,
        body: body,
      },
      apns: {
        headers: {
          "apns-priority": "10",
          "apns-push-type": "alert",
        },
        payload: {
          aps: {
            alert: {
              title: title,
              body: body,
            },
            sound: "default",
            badge: 1,
          },
        },
      },
    };
    

    Flutter Background Handler

    @pragma('vm:entry-point')
    Future backgroundMessageHandler(RemoteMessage remoteMessage) async {
      await Firebase.initializeApp();
      debugPrint('�� Background message received: ${remoteMessage.notification?.title}');
      return Future.value(true);
    }
    

    Key Observations

    • FCM tokens are valid (status 200 from Firebase Function)
    • APNs configuration works (Firebase Console notifications work)
    • Permissions are granted (notifications work when app is foreground)
    • Background modes are enabled in Info.plist
    • AppDelegate methods are called (logs show notifications are received)

    Question

    What could be causing iOS to receive FCM notifications in Release mode but not display them visually when the app is closed or in background? The fact that Firebase Console notifications work suggests the APNs configuration is correct, but there’s something specific about my custom Firebase Function payload or iOS configuration that’s preventing visual display in Release mode.

    1. ✅ Verified APNs environment is set to “production” in entitlements
    2. ✅ Confirmed application.registerForRemoteNotifications() is called
    3. ✅ Added @pragma('vm:entry-point') to prevent tree shaking
    4. ✅ Set FirebaseAppDelegateProxyEnabled to false
    5. ✅ Simplified APNs payload (removed content-available: 1)
    6. ✅ Verified Xcode Signing & Capabilities has Push Notifications enabled
    7. ✅ Tested with fresh FCM tokens instead of stored ones



    Source link

    Cloud Debug Firebase Flutter iOS Messaging mode notifications Release Work
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    React Native vs Flutter: An overview and 6 decision factors

    March 11, 2026

    uikit – Why the title doesn’t follow the navigation inline state in iOS 26

    March 11, 2026

    ios – OS emoji keyboard causes UI freeze in chat TextField Flutter

    March 10, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    Setting Up a Google Colab AI-Assisted Coding Environment That Actually Works

    March 11, 2026

    The economics of enterprise AI: What the Forrester TEI study reveals about Microsoft Foundry

    March 11, 2026

    The search for new bosons beyond Higgs – Physics World

    March 11, 2026

    Amazon is linking site hiccups to AI efforts

    March 11, 2026
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    Setting Up a Google Colab AI-Assisted Coding Environment That Actually Works

    March 11, 2026

    The economics of enterprise AI: What the Forrester TEI study reveals about Microsoft Foundry

    March 11, 2026

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2026 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.