Configurando badges para Flutter
1. Abra seu projeto iOS localizado em your_project/ios/Runner.xcworkspace e crie uma NotificationServiceExtension:


2. Abra o Podfile (localizado em your_project/ios/Podfile) e adicione a dependência PushwooshXCFramework para o NotificationServiceExtensionTarget:
target ‘NotificationService’ do pod ‘PushwooshXCFramework’, ‘>=6.5.0’end3. Instale os pods via Terminal:
cd ios && pod install4. Feche e reabra seu projeto Xcode.
5. Certifique-se de que seu Deployment target corresponde ao do Runner target; caso contrário, você pode encontrar um problema ao construir seu aplicativo (por exemplo, se você especificar iOS 10.0 no Runner e iOS 15.5 nos targets do NotificationService).
6. Adicione a capacidade App Groups aos targets Runner e NotificationService e adicione um novo grupo com o mesmo nome para ambos os targets:


7. Adicione a flag PW_APP_GROUPS_NAME do info.plist aos targets Runner e NotificationService com o nome do grupo como seu valor de string:

8. Vá para NotificationService.m e substitua seu código pelo seguinte:
#import “NotificationService.h”#import <Pushwoosh/PWNotificationExtensionManager.h>
@interface NotificationService ()<strong>@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);</strong>@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);}@endÉ isso!
Compartilhe seu feedback conosco
Anchor link toSeu feedback nos ajuda a criar uma experiência melhor, então adoraríamos ouvir de você se tiver algum problema durante o processo de integração do SDK. Se você enfrentar alguma dificuldade, não hesite em compartilhar suas opiniões conosco através deste formulário.