- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"Remote message received.");
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
completionHandler(UIBackgroundFetchResultNewData);
}
above delegate not being triggered while receiving remote notification when iOS app is in background or quit state.
but in foreground state below one is working
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
NSLog(@"willPresentNotification delegate triggered");
// NSLog(@"Foreground message received. %@", notification);
// UNNotificationContent *content = notification.request.content;
// NSDictionary *contentDict = content.userInfo;
// NSLog(@"Foreground notification received with content: %@", contentDict);
//
// [self sendNotificationWithActions];
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionBadge);
}
- In android its working perfectly fine.
- I am testing on simulater, xcode, ios 17