Useful or not, from you.
react-native-firebase [🐛] FIRMessagingRemoteMessage Expected a type

<!--- Note <= v5 is deprecated, v5 issues are unlikely to get attention. Feel free to ask in discussions instead.

Hello there you awesome person;

Please note that the issue list of this repo is exclusively for bug reports;

  1. For feature requests, questions and general support please use GitHub Discussions.
  2. If this is a setup issue then please make sure you've correctly followed the setup guides, most setup issues such as 'duplicate dex files', 'default app has not been initialized' etc are all down to an incorrect setup as the guides haven't been correctly followed. -->

<!-- NOTE: You can change any of the [ ] to [x] to mark an option(s) as selected -->

<!-- PLEASE DO NOT REMOVE ANY SECTIONS FROM THIS ISSUE TEMPLATE --> <!-- Leave them as they are even if they're irrelevant to your issue -->

Issue

<!-- Please describe your issue here --^ and provide as much detail as you can. --> <!-- Include code snippets that show your usages of the library in the context of your project. --> <!-- Snippets that also show how and where the library is imported in JS are useful to debug issues relating to importing or methods not found issues -->

Hello I am using "@ react-native-firebase / messaging": "^ 10.0.0" and while trying to build I get a type error of FIRMessagingRemoteMessage expected at lines 44,91,99,223,278,279 in RNFirebaseMessaging.m in ios.

node_modules/react-native-firebase/ios/RNFirebase/messaging/RNFirebaseMessaging.m:223:31: No visible @interface for 'FIRMessaging' declares the selector 'sendMessage:to:withMessageID:timeToLive:'

Project Files

<!-- Provide the contents of key project files which will help to debug --> <!-- For Example: --> <!-- - iOS: Podfile contents. --> <!-- - Android: android/build.gradle contents. --> <!-- - Android: android/app/build.gradle contents. --> <!-- - Android: AndroidManifest.xml contents. -->

<!-- ADD THE CONTENTS OF THE FILES IN THE PROVIDED CODE BLOCKS BELOW -->

Javascript

<details><summary>Click To Expand</summary> <p>

package.json:

# N/A
{
  "name": "",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "a-start": "cd android && ./gradlew clean && cd .. && react-native run-android",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "pod": "cd ios && pod install && cd .."
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.12.0",
    "@react-native-community/clipboard": "^1.2.3",
    "@react-native-community/datetimepicker": "^3.0.2",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/progress-bar-android": "^1.0.3",
    "@react-native-community/progress-view": "^1.1.1",
    "@react-native-community/viewpager": "^4.1.6",
    "@react-native-firebase/analytics": "^10.0.0",
    "@react-native-firebase/app": "^10.0.0",
    "@react-native-firebase/firestore": "^10.0.0",
    "@react-native-firebase/in-app-messaging": "^10.0.0",
    "@react-native-firebase/messaging": "^10.0.0",
    "@react-navigation/bottom-tabs": "^5.8.0",
    "@react-navigation/native": "^5.7.3",
    "@react-navigation/stack": "^5.9.0",
    "axios": "^0.20.0",
    "d3-array": "^2.7.1",
    "d3-scale": "^3.2.2",
    "d3-shape": "^2.0.0",
    "md5": "^2.3.0",
    "react": "16.13.1",
    "react-native": "0.63.2",
    "react-native-base64": "^0.1.0",
    "react-native-carousel-view": "^0.5.1",
    "react-native-dropdown-picker": "^3.6.8",
    "react-native-elements": "^2.3.1",
    "react-native-firebase": "^5.6.0",
    "react-native-gesture-handler": "^1.7.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-md5": "^1.0.0",
    "react-native-modal": "^11.5.6",
    "react-native-pdf": "^6.2.0",
    "react-native-reanimated": "^1.13.0",
    "react-native-restart": "0.0.17",
    "react-native-safe-area-context": "^3.1.7",
    "react-native-screens": "^2.10.1",
    "react-native-share": "^3.7.1",
    "react-native-svg": "^12.1.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-swipeable": "^0.6.0",
    "react-native-tab-view": "^2.15.2",
    "react-native-vector-icons": "^7.0.0",
    "react-native-webview": "^10.8.2",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5",
    "rn-fetch-blob": "^0.12.0",
    "utf8": "^3.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

firebase.json for react-native-firebase v6:

# N/A

</details>

iOS

<details><summary>Click To Expand</summary> <p>

ios/Podfile:

  • [ ] I'm not using Pods
  • [x] I'm using Pods and my Podfile looks like:
# N/A
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'entegra' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
  target 'entegraTests' do
    inherit! :complete
    # 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

target 'entegra-tvOS' do
  # Pods for entegra-tvOS

  target 'entegra-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

AppDelegate.m:

// N/A
#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@import Firebase;

#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
{
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"entegra"
                                            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];
  [FIRApp configure];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end

</p> </details>


RNFirebaseMessaging.m:

RCT_EXPORT_METHOD(sendMessage:(NSDictionary *) message resolve:(RCTPromiseResolveBlock) resolve reject:(RCTPromiseRejectBlock) reject) { if (!message[@"to"]) { reject(@"messaging/invalid-message", @"The supplied message is missing a 'to' field", nil); } NSString *to = message[@"to"]; NSString *messageId = message[@"messageId"]; NSNumber *ttl = message[@"ttl"]; NSDictionary *data = message[@"data"];

[[FIRMessaging messaging] sendMessage:data to:to withMessageID:messageId timeToLive:[ttl intValue]];

// TODO: Listen for send success / errors
resolve(nil);

}

Android

<details><summary>Click To Expand</summary> <p>

Have you converted to AndroidX?

<!--- Mark any options that apply below -->

  • [ ] 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 -->

</p> </details>


Environment

<details><summary>Click To Expand</summary> <p>

react-native info output:

<!-- Please run react-native info on your terminal and paste the contents into the code block below -->

 OUTPUT GOES HERE

<!-- change [ ] to [x] to select an option(s) -->

  • 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:
    • e.g. 10.0.0
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION

</p> </details>

<!-- Thanks for reading this far down ❤️ --> <!-- High quality, detailed issues are much easier to triage for maintainers -->

<!-- For bonus points, if you put a 🔥 (:fire:) emojii at the start of the issue title we'll know --> <!-- that you took the time to fill this out correctly, or, at least read this far -->


That's a useful answer
Without any help

@mikehardy "@react-native-firebase/app": "^10.0.0", "@react-native-firebase/messaging": "^10.0.0",

I tried but it didn't work.