iOS推送1.3.2及以前推送版本升级指导
因推送支持图片,GrowingPushExtensionKit中原有接口不支持弃用,需要修改为新接口。 将原来的接口替换 //旧接口+ (void)sendNotificationRequest:(UNNotificationRequest *)request withCompletionHandler:(void (^)(id response))completionHandler;

新接口

+ (void)handleNotificationRequest:(nonnull UNNotificationRequest *)request withCompletion:(nullable void(^)( NSArray <UNNotificationAttachment *>* _Nullable attachments, NSArray <NSError *>* _Nullable errors))handler;
1
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
2
self.contentHandler = contentHandler;
3
self.bestAttemptContent = [request.content mutableCopy];
4
5
[GrowingPushExtensionKit handleNotificationRequest:request
6
withCompletion:^(NSArray<UNNotificationAttachment *> * _Nullable attachments, NSArray<NSError *> * _Nullable errors) {
7
NSLog(@"执行成功");
8
NSLog(@"回调信息是 attachments = %@, error = %@", attachments, errors);
9
10
// Modify the notification content here...
11
self.bestAttemptContent.attachments = attachments;
12
self.contentHandler(self.bestAttemptContent);
13
}];
14
}
Copied!
测试能收到图片推送,则升级成功
Last modified 1yr ago
Copy link
Contents
新接口