Onesignal Badge 计数增量不起作用

Onesignal Badge count increment is not working

在Onesignal api中,我在字段中添加了isIos => true,ios_badgeType => Increase,ios_badgeCount => 1,content_available => true大批。 但是徽章计数始终保持为 1,不会随着多条消息的增加而增加。

这是我的负载详细信息:$fields = array( 'app_id' => "xxxxxx", 'included_segments' => array('All'), 'data' => array( "notification_type" => "update" ), 'contents' => $content, 'subtitle' => $subtitle, 'headings' => $heading, 'isIos' => true, 'ios_badgeType' => "Increase", 'ios_badgeCount' => 1, 'content_available' => true );

您必须添加通知扩展才能获得徽章自动更新。请关注link to setup.

此外,需要创建应用程序组并将两个包 ID 分配给该特定组。请参阅部分 -

In order for your application to be able to let push notifications increment/decrement the badge count, you need to set up an App Group for your application.

See here

详情请关注https://documentation.onesignal.com/docs/ios-sdk-app-groups-setup

您的应用组名称应为

group.{your_bundle_id}.onesignal

So for example, if your application's bundle identifier is com.test.app, your app group name should be group.com.test.app.onesignal.

Assign the group to both target.

  1. Open your Info.plist file and add a new OneSignal_app_groups_key as a String type.
  2. Enter the group name you checked in the last step as it's value.
  3. Make sure to do the same for the Info.plist under the OneSignalNotificationServiceExtension folder.