Configuración de badges para Flutter
- Abre tu proyecto de iOS ubicado en your_project/ios/Runner.xcworkspace y crea una NotificationServiceExtension:


- Abre el Podfile (ubicado en your_project/ios/Podfile) y añade la dependencia PushwooshXCFramework para el NotificationServiceExtensionTarget:
target ‘NotificationService’ do pod ‘PushwooshXCFramework’, ‘>=6.5.0’end- Instala los pods a través de la Terminal:
cd ios && pod install- Cierra y vuelve a abrir tu proyecto de Xcode.
-
Asegúrate de que tu Deployment target coincida con el del Runner target; de lo contrario, podrías encontrarte con un problema al compilar tu aplicación (por ejemplo, si especificas iOS 10.0 en el target Runner y iOS 15.5 en el target NotificationService).
-
Añade la capacidad de App Groups tanto al target Runner como al NotificationService y añade un nuevo grupo con el mismo nombre para ambos targets:


- Añade el flag PW_APP_GROUPS_NAME de info.plist tanto al target Runner como al NotificationService con el nombre del grupo como su valor de cadena:

- Ve a NotificationService.m y reemplaza su código con el siguiente:
#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);}@endComparte tus comentarios con nosotros
Anchor link toTus comentarios nos ayudan a crear una mejor experiencia, por lo que nos encantaría saber de ti si tienes algún problema durante el proceso de integración del SDK. Si encuentras alguna dificultad, no dudes en compartir tus opiniones con nosotros a través de este formulario.