Настройка бейджей для React Native
Поскольку плагин React Native не содержит заголовок PWNotificationExtensionManager, вам необходимо выполнить несколько дополнительных шагов для реализации бейджей в вашем проекте React Native.
1. Добавьте Notification Service Extension (File -> New -> Target…)
Anchor link to
2. Выберите “Notification Service Extension”
Anchor link to
3. Обновите код Notification Service Extension следующим образом:
Anchor link to#import "NotificationService.h"#import <Pushwoosh/PWNotificationExtensionManager.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];
[[PWNotificationExtensionManager sharedManager] handleNotificationRequest:request contentHandler: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);}
@end4. Свяжите зависимости с целью (target)
Anchor link toReact Native не связывает автоматически все необходимые зависимости с целью (target), созданной вручную, поэтому вам следует обновить Build Phases цели и предоставить необходимую информацию:

Просто нажмите на знак + под Compile Sources и Link Binary With Libraries и найдите необходимые библиотеки/фреймворки.
5. Добавьте возможность App Groups для обеих целей в Xcode и установите одну и ту же группу как для приложения, так и для расширения:
Anchor link to
6. Добавьте ключ PW_APP_GROUPS_NAME в info.plist обеих целей. Значение — это имя вашей группы приложений:
Anchor link to