إعداد الشارات لتطبيق Flutter
- افتح مشروع iOS الخاص بك الموجود في your_project/ios/Runner.xcworkspace وأنشئ NotificationServiceExtension:


- افتح ملف Podfile (الموجود في your_project/ios/Podfile) وأضف الاعتمادية PushwooshXCFramework لـ NotificationServiceExtensionTarget:
target ‘NotificationService’ do pod ‘PushwooshXCFramework’, ‘>=6.5.0’end- قم بتثبيت الـ pods عبر Terminal:
cd ios && pod install- أغلق مشروع Xcode الخاص بك وأعد فتحه.
-
تأكد من أن هدف النشر (Deployment target) يطابق الهدف في Runner؛ وإلا، قد تواجه مشكلة عند بناء تطبيقك (على سبيل المثال، إذا حددت iOS 10.0 في Runner و iOS 15.5 في أهداف NotificationService).
-
أضف إمكانية مجموعات التطبيقات (App Groups) إلى كل من هدفي Runner و NotificationService وأضف مجموعة جديدة بنفس الاسم لكلا الهدفين:


- أضف علامة PW_APP_GROUPS_NAME في ملف info.plist إلى كل من هدفي Runner و NotificationService مع اسم المجموعة كقيمة نصية لها:

- اذهب إلى NotificationService.m واستبدل الكود الخاص به بالكود التالي:
#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شاركنا ملاحظاتك
Anchor link toتساعدنا ملاحظاتك في إنشاء تجربة أفضل، لذلك نود أن نسمع منك إذا كان لديك أي مشاكل أثناء عملية دمج SDK. إذا واجهت أي صعوبات، فلا تتردد في مشاركة أفكارك معنا عبر هذا النموذج.