सामग्री पर जाएं

Flutter के लिए बैज सेट अप करना

1. your_project/ios/Runner.xcworkspace में स्थित अपना iOS प्रोजेक्ट खोलें और NotificationServiceExtension बनाएं:

2. Podfile खोलें (your_project/ios/Podfile में स्थित) और NotificationServiceExtensionTarget के लिए PushwooshXCFramework निर्भरता जोड़ें:

target ‘NotificationService’ do
pod ‘PushwooshXCFramework’, ‘>=6.5.0’
end

3. टर्मिनल के माध्यम से पॉड्स इंस्टॉल करें:

cd ios && pod install

4. अपना Xcode प्रोजेक्ट बंद करें और फिर से खोलें।

5. सुनिश्चित करें कि आपका डिप्लॉयमेंट टारगेट रनर टारगेट से मेल खाता हो; अन्यथा, आपको अपना ऐप बनाते समय किसी समस्या का सामना करना पड़ सकता है (उदाहरण के लिए, यदि आप रनर में iOS 10.0 और NotificationService टारगेट में iOS 15.5 निर्दिष्ट करते हैं)।

6. रनर और NotificationService दोनों टारगेट में ऐप ग्रुप्स क्षमता जोड़ें और दोनों टारगेट के लिए एक ही नाम का एक नया ग्रुप जोड़ें:

7. रनर और NotificationService दोनों टारगेट में PW_APP_GROUPS_NAME info.plist फ़्लैग जोड़ें, जिसमें ग्रुप का नाम उसकी स्ट्रिंग वैल्यू के रूप में हो:

8. 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 एकीकरण प्रक्रिया के दौरान कोई समस्या आती है तो हम आपसे सुनना चाहेंगे। यदि आपको कोई कठिनाई आती है, तो कृपया इस फ़ॉर्म के माध्यम से अपने विचार हमारे साथ साझा करने में संकोच न करें।