| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | 
							- //
 
- //  NotificationService.m
 
- //  NotificationServiceExtension
 
- //
 
- //  Created by iOS on 2023/4/22.
 
- //
 
- #import "NotificationService.h"
 
- #import <UIKit/UIKit.h>
 
- #import <OneSignal/OneSignal.h>
 
- @interface NotificationService ()
 
- @property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
 
- @property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
 
- //@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
 
- @property (nonatomic, strong) UNNotificationRequest *receivedRequest;
 
- //@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
 
- @end
 
- @implementation NotificationService
 
- - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
 
-     self.receivedRequest = request;
 
-         self.contentHandler = contentHandler;
 
-         self.bestAttemptContent = [request.content mutableCopy];
 
-     
 
-     [OneSignal didReceiveNotificationExtensionRequest:self.receivedRequest
 
-                            withMutableNotificationContent:self.bestAttemptContent
 
-                                        withContentHandler:self.contentHandler];
 
-     
 
- }
 
- - (void)serviceExtensionTimeWillExpire {
 
-     NSLog(@"------serviceExtensionTimeWillExpire-------");
 
-     [OneSignal serviceExtensionTimeWillExpireRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];
 
-         
 
-         self.contentHandler(self.bestAttemptContent);
 
- }
 
- @end
 
 
  |