Код: Выделить всё
#import "NotificationService.h"
#import "FirebaseMessaging.h"
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@end
@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 {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content,
// otherwise the original push payload will be used.
self.contentHandler(self.bestAttemptContent);
}
@end
Все еще я не могу видеть изображение в уведомлении, но NSE есть с заголовком. Присутствует? Или что -то не так с моей полезной нагрузкой FCM или уведомлениями.>
Подробнее здесь: https://stackoverflow.com/questions/797 ... -extension
Мобильная версия