react-native-firebase
react-native-firebase copied to clipboard
[🐛] [🔥 ] Unable to receive notifications on iOS from firebase console.
Issue
Describe your issue here
Currently we are experiencing some weird behaviour when we are trying to send notifications via the firebase console to all users of our application. They are unable to receive notifications through the firebase console exclusively on the iOS application. Android is working completely fine. Also if we use device tokens we are able to send to the iOS devices no problem as well (I can use the "test message" feature and send fine to the iOS device in question).
Project Files
Javascript
Click To Expand
package.json:
# N/A
firebase.json for react-native-firebase v6:
{
"$schema": "./node_modules/@react-native-firebase/app/firebase-schema.json",
"messaging_ios_auto_register_for_remote_messages": false
}
iOS
Click To Expand
ios/Podfile:
- [ ] I'm not using Pods
- [x] I'm using Pods and my Podfile looks like:
# N/A
AppDelegate.m:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
#import <UserNotifications/UserNotifications.h>
#import <RNCPushNotificationIOS.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <CodePush/CodePush.h>
#import <IntercomModule.h>
#import <Firebase.h>
#import "RNBootSplash.h"
#import <React/RCTLinkingManager.h>
#import <RNBranch/RNBranch.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef DEBUG
[RNBranch useTestInstance];
[RNBranch setDebug];
#endif
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
#if DEBUG
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.js" fallbackResource:nil];
#else
NSURL *jsCodeLocation = [CodePush bundleURL];
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation moduleProvider:nil launchOptions:launchOptions];
#if RCT_DEV
[bridge moduleForClass:[RCTDevLoadingView class]];
#endif
// Obscured project name
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"*****" initialProperties:nil];
// Intercom
[IntercomModule initialize:@"ios_sdk-9123129eedbcbe7c130e11a341b1673b40e371cb" withAppId:@"vsffcg6p"];
// Firebase
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
[RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; // <- initialization using the storyboard file name
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
return YES;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
if ([RNBranch application:application openURL:url options:options]) {
// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
}
return [RCTLinkingManager application:application openURL:url options:options];
}
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
}
// IOS 10+ Required for localNotification event
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
completionHandler();
}
// IOS 4-10 Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RNCPushNotificationIOS didReceiveLocalNotification:notification];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [CodePush bundleURL];
#endif
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
return [RNBranch continueUserActivity:userActivity];
}
@end
Android
Click To Expand
Have you converted to AndroidX?
- [ ] my application is an AndroidX application?
- [ ] I am using
android/gradle.settingsjetifier=truefor Android compatibility? - [ ] I am using the NPM package
jetifierfor 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 12.2.1
CPU: (8) arm64 Apple M1
Memory: 102.86 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.6.0 - /opt/homebrew/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.5.1 - /opt/homebrew/bin/npm
Watchman: 2022.03.07.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.4/13F17a - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: ^0.67.1 => 0.67.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-firebaseversion you're using that has this issue:-
14.9.3
-
-
Firebasemodule(s) you're using that has the issue:-
Messaging
-
-
Are you using
TypeScript?-
Y&3.8.3
-
- 👉 Check out
React Native FirebaseandInvertaseon Twitter for updates on the library.
Experiencing a similar issue
@josh-the-dev Just curious if you found out what the issue was? Thanks
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.