[🐛] message().onMessage doesn’t trigger IOS only.

Issue

messaging().onMessage doesn’t trigger for IOS but works for Android. Also normal notifications work.
I’m sending data-only notifications.

Placed inside App.tsx


    /**
     * Handle messages when in foreground
     */
    useEffect(() => {
        const unsubscribe = messaging().onMessage(async remoteMessage => {
            if (remoteMessage.data?.score) {
                dispatch(updateScore(parseFloat(remoteMessage.data.score)));
            }
        });

        return unsubscribe;
    }, []);

Fcm payload looks like:
POST: https://fcm.googleapis.com/fcm/send

{
      "to":"{{fcmToken}}",
      "data":{
          "score":1.3
      }
   
}

That works on Android not on IOS. Doesn’t enter the handler at all.

If I close the app I am able to receive notifications using:

{
      "to":"{{fcmToken}}",
      "data":{},
      "notification":{
        "body":"This is an FCM notification message!",
        "title":"FCM Message"
      }
   
}

Describe your issue here


Project Files

Javascript

Click To Expand

package.json:

{
    "name": "Driven",
    "version": "2.0.0",
    "private": true,
    "scripts": {
        "start": "react-native start --reset-cache",
        "test": "jest",
        "lint": "eslint .",
        "android": "yarn tsc && ENVFILE=.env.dev npx react-native run-android",
        "android-release": "npx react-native run-android --variant=release",
        "ios": "yarn tsc && ENVFILE=.env.dev npx react-native run-ios",
        "ios12": "yarn tsc && ENVFILE=.env.dev npx react-native run-ios --simulator=\"iPhone 12\"",
        "fast-test": "jest -- FastTests"
    },
    "dependencies": {
        "@expo/react-native-action-sheet": "2.1.0",
        "@react-native-async-storage/async-storage": "^1.13.1",
        "@react-native-community/audio-toolkit": "^2.0.3",
        "@react-native-community/masked-view": "^0.1.10",
        "@react-native-community/netinfo": "2.0.10",
        "@react-native-community/slider": "^3.0.3",
        "@react-native-firebase/app": "^10.5.0",
        "@react-native-firebase/messaging": "^10.5.1",
        "@reduxjs/toolkit": "^1.4.0",
        "axios": "^0.21.0",
        "moment": "^2.29.1",
        "prop-types": "^15.7.2",
        "react": "16.13.1",
        "react-native": "0.63.4",
        "react-native-animatable": "^1.3.3",
        "react-native-animated-spinkit": "^1.4.1",
        "react-native-bootsplash": "2.2.8",
        "react-native-communications": "^2.2.1",
        "react-native-config": "^1.4.2",
        "react-native-device-info": "^8.0.1",
        "react-native-elements": "2.3.2",
        "react-native-fullwidth-image": "^0.1.3",
        "react-native-gesture-handler": "^1.8.0",
        "react-native-iphone-x-helper": "^1.3.0",
        "react-native-keep-awake": "^4.0.0",
        "react-native-keyboard-aware-scroll-view": "^0.9.3",
        "react-native-keyboard-spacer": "^0.4.1",
        "react-native-lightbox": "^0.8.1",
        "react-native-linear-gradient": "^2.5.6",
        "react-native-markdown-display": "^7.0.0-alpha.2",
        "react-native-orientation-locker": "^1.2.0",
        "react-native-parsed-text": "^0.0.22",
        "react-native-popup-dialog": "https://github.com/hellodriven/react-native-popup-dialog.git",
        "react-native-reanimated": "^1.13.1",
        "react-native-responsive-screen": "^1.4.1",
        "react-native-restart": "^0.0.17",
        "react-native-safe-area-context": "^3.1.8",
        "react-native-screens": "2.11.0",
        "react-native-shake": "^3.5.0",
        "react-native-svg": "^12.1.0",
        "react-native-svg-charts": "^5.4.0",
        "react-native-vector-icons": "^7.1.0",
        "react-native-video": "^4.4.1",
        "react-native-webview": "^10.10.2",
        "react-navigation": "^4.4.3",
        "react-navigation-drawer": "^2.6.0",
        "react-navigation-stack": "^2.10.0",
        "react-redux": "^7.2.2",
        "redux": "^4.0.5",
        "retry-axios": "^2.4.0",
        "rn-fetch-blob": "^0.12.0",
        "uuid": "^8.3.1"
    },
    "devDependencies": {
        "@babel/core": "^7.8.4",
        "@babel/runtime": "^7.8.4",
        "@react-native-community/eslint-config": "^1.1.0",
        "@types/jest": "^26.0.15",
        "@types/react": "^16.9.54",
        "@types/react-native": "^0.63.30",
        "@types/react-test-renderer": "^16.9.3",
        "babel-jest": "^25.1.0",
        "babel-plugin-module-resolver": "^4.0.0",
        "eslint": "^6.5.1",
        "jest": "^25.1.0",
        "metro-react-native-babel-preset": "^0.59.0",
        "react-test-renderer": "16.13.1",
        "typescript": "^4.0.5"
    },
    "jest": {
        "preset": "react-native",
        "setupFiles": [
            "./jestSetup.js"
        ],
        "modulePathIgnorePatterns": [
            "testUtil"
        ]
    }
}

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I’m not using Pods
  • I’m using Pods and my Podfile looks like:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'

target 'Driven' do
    config = use_native_modules!
    use_react_native!(:path => config["reactNativePath"])


  target 'DrivenTests' do
    inherit! :search_paths
    # Pods for testing
  end


  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
    
    
    
  end

end

AppDelegate.m:

#import  <Firebase.h>

  

#import  "AppDelegate.h"

  

#import  <React/RCTBridge.h>

#import  <React/RCTBundleURLProvider.h>

#import  <React/RCTRootView.h>

  

// Deep Linking:

#import  <React/RCTLinkingManager.h>

  

//Bootsplash

#import  "RNBootSplash.h"  // <- add the header import

  

//Lock orientation

#import  "Orientation.h"

  

#ifdef FB_SONARKIT_ENABLED

#import  <FlipperKit/FlipperClient.h>

#import  <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>

#import  <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>

#import  <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>

#import  <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>

#import  <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

static  void  InitializeFlipper(UIApplication *application) {

FlipperClient *client = [FlipperClient sharedClient];

SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];

[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];

[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];

[client addPlugin:[FlipperKitReactPlugin new]];

[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];

[client start];

}

#endif

  
  

@implementation  AppDelegate

  

- (BOOL)application:(UIApplication *)application  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

//Firebase v6

if ([FIRApp defaultApp] == nil) {

[FIRApp configure];

}

#ifdef FB_SONARKIT_ENABLED

InitializeFlipper(application);

#endif

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge

moduleName:@"Driven"

initialProperties:nil];

  

rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

UIViewController *rootViewController = [UIViewController new];

rootViewController.view = rootView;

self.window.rootViewController = rootViewController;

[self.window makeKeyAndVisible];

//BootSplash

[RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; // <- initialization using the storyboard file name

  

return  YES;

}

  

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge

{

#if DEBUG

return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

#else

return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

#endif

}

  

// Deep linking

- (BOOL)application:(UIApplication *)application

openURL:(NSURL *)url

options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

{

return [RCTLinkingManager application:application openURL:url options:options];

}

  

// Universal linking

- (BOOL)application:(UIApplication *)application

continueUserActivity:(NSUserActivity *)userActivity

restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler

{

return [RCTLinkingManager application:application

continueUserActivity:userActivity

restorationHandler:restorationHandler];

}

  

//Orientation locker

- (UIInterfaceOrientationMask)application:(UIApplication *)application  supportedInterfaceOrientationsForWindow:(UIWindow *)window {

return [Orientation getOrientation];

}

  

@end

Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

Click To Expand

react-native info output:

System:

OS: macOS 11.1

CPU: (4) x64 Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz

Memory: 179.33 MB / 16.00 GB

Shell: 5.8 - /bin/zsh

Binaries:

Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node

Yarn: 1.22.10 - /usr/local/bin/yarn

npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm

Watchman: 4.9.0 - /usr/local/bin/watchman

Managers:

CocoaPods: 1.10.0 - /usr/local/bin/pod

SDKs:

iOS SDK:

Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2

Android SDK:

API Levels: 23, 26, 27, 28, 29, 30

Build Tools: 26.0.3, 28.0.3, 29.0.2, 30.0.2

System Images: android-30 | Google APIs Intel x86 Atom

Android NDK: Not Found

IDEs:

Android Studio: 4.1 AI-201.8743.12.41.6858069

Xcode: 12.3/12C33 - /usr/bin/xcodebuild

Languages:

Java: 1.8.0_272 - /usr/bin/javac

Python: 2.7.16 - /usr/bin/python

npmPackages:

@react-native-community/cli: Not Found

react: 16.13.1 => 16.13.1

react-native: 0.63.4 => 0.63.4

react-native-macos: Not Found

npmGlobalPackages:

*react-native*: Not Found
  • Platform that you’re experiencing the issue on:
    • [ x] iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you’re using that has this issue:
    -“@react-native-firebase/app”: “^10.5.0”,
    “@react-native-firebase/messaging”: “^10.5.1”,`
  • Firebase module(s) you’re using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y & VERSION ^4.0.5

1 possible answer(s) on “[🐛] message().onMessage doesn’t trigger IOS only.

  1. OK I found the issue. For IOS you must add another content_available field:

    {
          "to":"{{fcmToken}}",
          "data":{
              "score":1.4
          },
          "content_available":true
       
    }
    

[🐛] message().onMessage doesn’t trigger IOS only.

Issue

messaging().onMessage doesn’t trigger for IOS but works for Android. Also normal notifications work.
I’m sending data-only notifications.

Placed inside App.tsx


    /**
     * Handle messages when in foreground
     */
    useEffect(() => {
        const unsubscribe = messaging().onMessage(async remoteMessage => {
            if (remoteMessage.data?.score) {
                dispatch(updateScore(parseFloat(remoteMessage.data.score)));
            }
        });

        return unsubscribe;
    }, []);

Fcm payload looks like:
POST: https://fcm.googleapis.com/fcm/send

{
      "to":"{{fcmToken}}",
      "data":{
          "score":1.3
      }
   
}

That works on Android not on IOS. Doesn’t enter the handler at all.

If I close the app I am able to receive notifications using:

{
      "to":"{{fcmToken}}",
      "data":{},
      "notification":{
        "body":"This is an FCM notification message!",
        "title":"FCM Message"
      }
   
}

Describe your issue here


Project Files

Javascript

Click To Expand

package.json:

{
    "name": "Driven",
    "version": "2.0.0",
    "private": true,
    "scripts": {
        "start": "react-native start --reset-cache",
        "test": "jest",
        "lint": "eslint .",
        "android": "yarn tsc && ENVFILE=.env.dev npx react-native run-android",
        "android-release": "npx react-native run-android --variant=release",
        "ios": "yarn tsc && ENVFILE=.env.dev npx react-native run-ios",
        "ios12": "yarn tsc && ENVFILE=.env.dev npx react-native run-ios --simulator=\"iPhone 12\"",
        "fast-test": "jest -- FastTests"
    },
    "dependencies": {
        "@expo/react-native-action-sheet": "2.1.0",
        "@react-native-async-storage/async-storage": "^1.13.1",
        "@react-native-community/audio-toolkit": "^2.0.3",
        "@react-native-community/masked-view": "^0.1.10",
        "@react-native-community/netinfo": "2.0.10",
        "@react-native-community/slider": "^3.0.3",
        "@react-native-firebase/app": "^10.5.0",
        "@react-native-firebase/messaging": "^10.5.1",
        "@reduxjs/toolkit": "^1.4.0",
        "axios": "^0.21.0",
        "moment": "^2.29.1",
        "prop-types": "^15.7.2",
        "react": "16.13.1",
        "react-native": "0.63.4",
        "react-native-animatable": "^1.3.3",
        "react-native-animated-spinkit": "^1.4.1",
        "react-native-bootsplash": "2.2.8",
        "react-native-communications": "^2.2.1",
        "react-native-config": "^1.4.2",
        "react-native-device-info": "^8.0.1",
        "react-native-elements": "2.3.2",
        "react-native-fullwidth-image": "^0.1.3",
        "react-native-gesture-handler": "^1.8.0",
        "react-native-iphone-x-helper": "^1.3.0",
        "react-native-keep-awake": "^4.0.0",
        "react-native-keyboard-aware-scroll-view": "^0.9.3",
        "react-native-keyboard-spacer": "^0.4.1",
        "react-native-lightbox": "^0.8.1",
        "react-native-linear-gradient": "^2.5.6",
        "react-native-markdown-display": "^7.0.0-alpha.2",
        "react-native-orientation-locker": "^1.2.0",
        "react-native-parsed-text": "^0.0.22",
        "react-native-popup-dialog": "https://github.com/hellodriven/react-native-popup-dialog.git",
        "react-native-reanimated": "^1.13.1",
        "react-native-responsive-screen": "^1.4.1",
        "react-native-restart": "^0.0.17",
        "react-native-safe-area-context": "^3.1.8",
        "react-native-screens": "2.11.0",
        "react-native-shake": "^3.5.0",
        "react-native-svg": "^12.1.0",
        "react-native-svg-charts": "^5.4.0",
        "react-native-vector-icons": "^7.1.0",
        "react-native-video": "^4.4.1",
        "react-native-webview": "^10.10.2",
        "react-navigation": "^4.4.3",
        "react-navigation-drawer": "^2.6.0",
        "react-navigation-stack": "^2.10.0",
        "react-redux": "^7.2.2",
        "redux": "^4.0.5",
        "retry-axios": "^2.4.0",
        "rn-fetch-blob": "^0.12.0",
        "uuid": "^8.3.1"
    },
    "devDependencies": {
        "@babel/core": "^7.8.4",
        "@babel/runtime": "^7.8.4",
        "@react-native-community/eslint-config": "^1.1.0",
        "@types/jest": "^26.0.15",
        "@types/react": "^16.9.54",
        "@types/react-native": "^0.63.30",
        "@types/react-test-renderer": "^16.9.3",
        "babel-jest": "^25.1.0",
        "babel-plugin-module-resolver": "^4.0.0",
        "eslint": "^6.5.1",
        "jest": "^25.1.0",
        "metro-react-native-babel-preset": "^0.59.0",
        "react-test-renderer": "16.13.1",
        "typescript": "^4.0.5"
    },
    "jest": {
        "preset": "react-native",
        "setupFiles": [
            "./jestSetup.js"
        ],
        "modulePathIgnorePatterns": [
            "testUtil"
        ]
    }
}

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I’m not using Pods
  • I’m using Pods and my Podfile looks like:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'

target 'Driven' do
    config = use_native_modules!
    use_react_native!(:path => config["reactNativePath"])


  target 'DrivenTests' do
    inherit! :search_paths
    # Pods for testing
  end


  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
    
    
    
  end

end

AppDelegate.m:

#import  <Firebase.h>

  

#import  "AppDelegate.h"

  

#import  <React/RCTBridge.h>

#import  <React/RCTBundleURLProvider.h>

#import  <React/RCTRootView.h>

  

// Deep Linking:

#import  <React/RCTLinkingManager.h>

  

//Bootsplash

#import  "RNBootSplash.h"  // <- add the header import

  

//Lock orientation

#import  "Orientation.h"

  

#ifdef FB_SONARKIT_ENABLED

#import  <FlipperKit/FlipperClient.h>

#import  <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>

#import  <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>

#import  <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>

#import  <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>

#import  <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

static  void  InitializeFlipper(UIApplication *application) {

FlipperClient *client = [FlipperClient sharedClient];

SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];

[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];

[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];

[client addPlugin:[FlipperKitReactPlugin new]];

[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];

[client start];

}

#endif

  
  

@implementation  AppDelegate

  

- (BOOL)application:(UIApplication *)application  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

//Firebase v6

if ([FIRApp defaultApp] == nil) {

[FIRApp configure];

}

#ifdef FB_SONARKIT_ENABLED

InitializeFlipper(application);

#endif

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge

moduleName:@"Driven"

initialProperties:nil];

  

rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

UIViewController *rootViewController = [UIViewController new];

rootViewController.view = rootView;

self.window.rootViewController = rootViewController;

[self.window makeKeyAndVisible];

//BootSplash

[RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; // <- initialization using the storyboard file name

  

return  YES;

}

  

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge

{

#if DEBUG

return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

#else

return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

#endif

}

  

// Deep linking

- (BOOL)application:(UIApplication *)application

openURL:(NSURL *)url

options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

{

return [RCTLinkingManager application:application openURL:url options:options];

}

  

// Universal linking

- (BOOL)application:(UIApplication *)application

continueUserActivity:(NSUserActivity *)userActivity

restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler

{

return [RCTLinkingManager application:application

continueUserActivity:userActivity

restorationHandler:restorationHandler];

}

  

//Orientation locker

- (UIInterfaceOrientationMask)application:(UIApplication *)application  supportedInterfaceOrientationsForWindow:(UIWindow *)window {

return [Orientation getOrientation];

}

  

@end

Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

Click To Expand

react-native info output:

System:

OS: macOS 11.1

CPU: (4) x64 Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz

Memory: 179.33 MB / 16.00 GB

Shell: 5.8 - /bin/zsh

Binaries:

Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node

Yarn: 1.22.10 - /usr/local/bin/yarn

npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm

Watchman: 4.9.0 - /usr/local/bin/watchman

Managers:

CocoaPods: 1.10.0 - /usr/local/bin/pod

SDKs:

iOS SDK:

Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2

Android SDK:

API Levels: 23, 26, 27, 28, 29, 30

Build Tools: 26.0.3, 28.0.3, 29.0.2, 30.0.2

System Images: android-30 | Google APIs Intel x86 Atom

Android NDK: Not Found

IDEs:

Android Studio: 4.1 AI-201.8743.12.41.6858069

Xcode: 12.3/12C33 - /usr/bin/xcodebuild

Languages:

Java: 1.8.0_272 - /usr/bin/javac

Python: 2.7.16 - /usr/bin/python

npmPackages:

@react-native-community/cli: Not Found

react: 16.13.1 => 16.13.1

react-native: 0.63.4 => 0.63.4

react-native-macos: Not Found

npmGlobalPackages:

*react-native*: Not Found
  • Platform that you’re experiencing the issue on:
    • [ x] iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you’re using that has this issue:
    -“@react-native-firebase/app”: “^10.5.0”,
    “@react-native-firebase/messaging”: “^10.5.1”,`
  • Firebase module(s) you’re using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y & VERSION ^4.0.5

1 possible answer(s) on “[🐛] message().onMessage doesn’t trigger IOS only.

  1. OK I found the issue. For IOS you must add another content_available field:

    {
          "to":"{{fcmToken}}",
          "data":{
              "score":1.4
          },
          "content_available":true
       
    }