通知服务扩展无效

问题描述 投票:1回答:1

我正在创建一个iOS应用程序(Objective C和xcode 8.3)。我已经将推送通知与firebase集成在一起。它工作正常。现在我需要显示图像通知(Rich Notification)。我创建了Notification Service Extension。我在app delegate中创建了类别标识符,并将其设置为Notification Service Extension的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]];
ios objective-c iphone push-notification rich-notifications
1个回答
1
投票

在您的有效负载中包含“mutable-content”:1并再次发送通知。

© www.soinside.com 2019 - 2024. All rights reserved.