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


- 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’end- Instale os pods via Terminal:
cd ios && pod install- Feche e reabra seu projeto Xcode.
-
Certifique-se de que seu Deployment target corresponde ao do Runner target; caso contrário, você pode enfrentar um problema ao construir seu aplicativo (por exemplo, se você especificar iOS 10.0 no Runner e iOS 15.5 nos targets da NotificationService).
-
Adicione a capacidade App Groups aos targets Runner e NotificationService e adicione um novo grupo com o mesmo nome para ambos os targets:


- 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:

- 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);}@endCompartilhe 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.