a notificación enriquecida de @IOS didReceiveNotificationRequest no se activa

Estoy desarrollando una aplicación para iPhone usando el objetivo-c. La notificación push básica funciona correctamente. Ahora quiero agregar notificaciones enriquecidas en mi aplicación, pero no puedo hacer que se active didReceiveNotificationRequest en NotificationService.

Aquí está la carga de notificación que recibo en Appdelegate:

https: //image.ibb.co/ndA2Qo/grab.pn

Aquí está el archivo NotificationService.m;

#import "NotificationService.h"
#import "Common.h"

@interface NotificationService ()

@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@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];
NSLog(@"didReceiveNotificationRequest");
// Modify the notification content here...
// load the attachment
NSDictionary *userInfo = request.content.userInfo;
NSString *imageURL = [userInfo valueForKey:@"thumbnail_image"];
NSArray *parts = [imageURL componentsSeparatedByString:@"."];
NSString *extension = [parts lastObject];
[self loadAttachmentForUrlString:imageURL
                        withExtension:extension
               completionHandler:^(UNNotificationAttachment *attachment) {
                   if (attachment) {
                       self.bestAttemptContent.attachments = [NSArray arrayWithObject:attachment];
                   }
                   //self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];

                   self.contentHandler(self.bestAttemptContent);
               }];



}

- (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);
}

- (void)loadAttachmentForUrlString:(NSString *)urlString withExtension:(NSString *)extension completionHandler:(void(^)(UNNotificationAttachment *))completionHandler  {

__block UNNotificationAttachment *attachment = nil;
NSURL *attachmentURL = [NSURL URLWithString:urlString];

NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[[session downloadTaskWithURL:attachmentURL
            completionHandler:^(NSURL *temporaryFileLocation, NSURLResponse *response, NSError *error) {
                if (error != nil) {
                    NSLog(@"%@", error.localizedDescription);
                } else {
                    NSFileManager *fileManager = [NSFileManager defaultManager];
                    NSURL *localURL = [NSURL fileURLWithPath:[temporaryFileLocation.path stringByAppendingString:extension]];
                    [fileManager moveItemAtURL:temporaryFileLocation toURL:localURL error:&error];

                    NSError *attachmentError = nil;
                    attachment = [UNNotificationAttachment attachmentWithIdentifier:@"" URL:localURL options:nil error:&attachmentError];
                    if (attachmentError) {
                        NSLog(@"%@", attachmentError.localizedDescription);
                    }
                }
                completionHandler(attachment);
            }] resume];
}

@end

¿Qué me estoy perdiendo

Por favor aconséjame

Semih

Respuestas a la pregunta(2)

Su respuesta a la pregunta