Проверьте некоторые журналы изменений в файле Notitifcationservice.m (расширение службы уведомлений)
Для модификации уведомления мы использовали расширение службы уведомлений, но я не могу найти некоторые журналы в моей консоли xcode.
(void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
// Modify the notification content here...
NSLog(@"tesrrrr");(Missing in console)
self.bestAttemptContent.title = [NSString stringWithFormat:self.getfuction, self.bestAttemptContent.title];
self.bestAttemptContent.body = [NSString stringWithFormat:@"%@[ body added Manually ", self.bestAttemptContent.body];
self.contentHandler(self.bestAttemptContent);
- (NSString *) getfuction {
NSLog(@"xyz");
NSURL *url = [NSURL URLWithString:@"http://jsonplaceholder.typicode.com/posts/1"];
NSData *data = [NSData dataWithContentsOfURL:url];
NSString *ret = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"ret=%@", ret);(Still Missing in console)
return ret ;
}
Nslog не входит в консоль Xcode.
Тот же код, помещенный в Appdelegate.m, работает нормально
1 ответ
Please try to run your application with UNNotificationServiceExtension target that you have created for Rich Notifications.
Don't forgot to add "mutable-content" in payload and your "aps" payload should be like this:
{
"aps": {
"alert": {
"body": "Het gaat over 15 minuten regenen in Alkmaar",
"title": "Buienalert"
},
"mutable-content": 1
},
"attachment-url": "https://api.buienradar.nl/Image/1.0/RadarMapNL"
}
Hope, it would help you.