Picture not displaying in iOS push notification utilizing Notification Service Extension in React Native with Firebase

0
2
Picture not displaying in iOS push notification utilizing Notification Service Extension in React Native with Firebase


I am engaged on a React Native mission the place I’ve carried out a Notification Service Extension (NSE) to show wealthy push notifications with photos on iOS. I am utilizing Firebase Cloud Messaging (FCM) to ship the push notifications.

The NSE is triggering appropriately — I can see that the title is modified with [NSE], which confirms the extension is operating. Nonetheless, the picture is just not being proven within the notification, despite the fact that I am passing a sound public picture URL.

I’ve added a debugger marker to confirm NSE is operating that is NotificationService.m Snippet:

#import “NotificationService.h”
#import “FirebaseMessaging.h”

@interface NotificationService ()

@property (nonatomic, robust) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, robust) UNMutableNotificationContent *bestAttemptContent;

@finish

@implementation NotificationService

  • (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];

    // Debug marker
    self.bestAttemptContent.title = [self.bestAttemptContent.title stringByAppendingString:@” [NSE]”];

    [[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler];

}

  • (void)serviceExtensionTimeWillExpire {
    // Known as simply earlier than the extension might be terminated by the system.
    // Use this as a chance to ship your “greatest try” at modified content material, in any other case the unique push payload might be used.
    self.contentHandler(self.bestAttemptContent);
    }

@finish

The Ios Growth Goal can be suitableas you may see

Nonetheless I’m not capable of see the picture in notification however NSE is there with Title take a look

Query:

Why is the picture not displaying within the iOS notification despite the fact that the NSE is triggered and the picture URL is current?

Is it as a result of I’m testing on the iOS Simulator? Or is there one thing improper with my FCM payload or NotificationService.m logic?

Any recommendation or working examples can be appreciated!

LEAVE A REPLY

Please enter your comment!
Please enter your name here