Configuration des badges pour Flutter
1. Ouvrez votre projet iOS situé dans your_project/ios/Runner.xcworkspace et créez une NotificationServiceExtension :


2. Ouvrez le Podfile (situé dans your_project/ios/Podfile) et ajoutez la dépendance PushwooshXCFramework à la cible NotificationServiceExtensionTarget :
target ‘NotificationService’ do pod ‘PushwooshXCFramework’, ‘>=6.5.0’end
3. Installez les pods via le Terminal :
cd ios && pod install
4. Fermez et rouvrez votre projet Xcode.
5. Assurez-vous que votre cible de déploiement (Deployment target) correspond à celle de la cible Runner ; sinon, vous pourriez rencontrer un problème lors de la compilation de votre application (par exemple, si vous spécifiez iOS 10.0 dans la cible Runner et iOS 15.5 dans la cible NotificationService).
6. Ajoutez la capacité App Groups aux cibles Runner et NotificationService, et ajoutez un nouveau groupe avec le même nom pour les deux cibles :


7. Ajoutez l’indicateur PW_APP_GROUPS_NAME au fichier info.plist des cibles Runner et NotificationService, avec le nom du groupe comme valeur de chaîne (string) :

8. Allez dans NotificationService.m et remplacez son code par le suivant :
#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
C’est tout !
Partagez vos commentaires avec nous
Anchor link toVos commentaires nous aident à créer une meilleure expérience. Nous serions donc ravis de connaître votre avis si vous rencontrez des problèmes lors du processus d’intégration du SDK. Si vous rencontrez des difficultés, n’hésitez pas à nous faire part de vos réflexions via ce formulaire.