0

So I have problem with notification in IOS, I successfully received the notification in Android but not in IOS. To configure notifications for IOS I followed the documentation of react-native firebase, here are the two links that help me

So, here is my configuration

Podfile Podfile AppDelegate.h enter image description here `AppDelegate.m``

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <Firebase.h>
#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  [RNFirebaseNotifications configure];

  NSURL *jsCodeLocation;

  ...
  return YES;
}

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
  [[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
  [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
  [[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
}
@end

here are the libraries I use

Libraryenter image description here

Do you know where I made the wrong configuration to implement notifications for IOS?

  • Are you trying to get the notifications in a simulator? If so, you should switch to a real device as iOS doesn't allow notifications to be received on a simulator. Also, if you have used Pods then can you verify that those are correctly being installed? The screenshot you attached shows the libraries not the pods dir. – Suraj Malviya Apr 16 at 1:11
  • make sure your componentWillUnmount is not at the bottom. I made the mistake once and, lo and behold the notification for iOS works – Emma Apr 16 at 2:52
  • 1
    Did you add Google-services.plist file to your project? and in firebase did you add your developer account key or apns certificates? – Kranthi Apr 16 at 5:45
  • @SurajMalviya - no I don't test the application on the simulator and on my Pods folder there are all the folders (i.e. Firebase, FirebaseMessaging...) – diego Apr 16 at 7:39
  • @Emma - whereabouts ? my method is in this order : constructor (){} componentDidMount(){} componentWillUnmount(){} ... – diego Apr 16 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.