我正在创建一个 iOS 应用程序( Objective-C 和 xcode 8.3)。我已经将推送通知与 firebase 集成在一起。它工作正常。现在我需要显示带有图像的通知(丰富的通知)。我创建了通知服务扩展。我在应用程序委托(delegate)中创建了类别标识符并将其设置到通知服务扩展的 info.plist 中。我还为 Notification Service Extension 启用了推送通知。我在通知负载中添加了“mutable_content”。问题是,当发送通知控件时,不会触发通知服务扩展部分。问题是什么?我错过了什么吗?我在 DidFinishLaunchingWithOption 中编写了以下代码块。
UNNotificationCategory* generalCategory = [UNNotificationCategory
categoryWithIdentifier:@"GENERAL"
actions:@[]
intentIdentifiers:@[]
options:UNNotificationCategoryOptionCustomDismissAction];
// Register the notification categories.
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
[center setNotificationCategories:[NSSet setWithObjects:generalCategory, nil]];
最佳答案
在您的负载中包含 "mutable-content": 1 并再次发送通知。
关于ios - 通知服务扩展不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46342291/