Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Push Notifications Firebase iOS - Notifications coming without sound

$
0
0

I'm working on a project(REACT NATIVE) using firebase for push notifications.For the Android part everything is alright, however on iOS the notifications are coming without sound.I don't know if the problem is native to Swift or something from the firebase itself.

in case i can solve with native code, look at the code below...

AppDelegate.h

#import <React/RCTBridgeDelegate.h>#import <UIKit/UIKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>@property (nonatomic, strong) UIWindow *window;@end

AppDelegate.m

#import "AppDelegate.h"#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>#import <Firebase.h>#import "RNFirebaseNotifications.h"#import "RNFirebaseMessaging.h"#import <React/RCTLinkingManager.h>#import <RNCPushNotificationIOS.h>#import <RadarSDK/RadarSDK.h>#import <GoogleMaps/GoogleMaps.h>#import <CodePush/CodePush.h>@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  [GMSServices provideAPIKey:@"**************"]; // add this line using the api key obtained from Google Console  [FIRApp configure];  [RNFirebaseNotifications configure];  [Radar initializeWithPublishableKey:@"prj_live_pk_*************************"];  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge                                                   moduleName:@"*****"                                            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];  return YES;}- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfofetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{  [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];}- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {  [[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];}- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge{#if DEBUG  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];#else  return [CodePush bundleURL];#endif}- (BOOL)application:(UIApplication *)application   openURL:(NSURL *)url   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{  return [RCTLinkingManager application:application openURL:url options:options];}@end

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>