ios - iOS 应用程序图标上未显示角标(Badge)

标签 ios apple-push-notifications

我发送了带有角标(Badge)的推送通知,但它不会增加应用程序图标上的数字。我在电话通知下看到一件事,我的应用程序没有角标(Badge)选项。任何人都知道我如何将角标(Badge)选项显示在通知窗口中的应用程序设置下。 notification image

最佳答案

修复此问题如果您在应用程序通知设置中的 requestAuthorizationWithOptions 期间不传递 UNAuthorizationOptionBadge,则不显示角标(Badge)选项,并且最终您将不会收到角标(Badge)通知,无论是您正在从服务器端发送带有角标(Badge)的通知。

UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge)
                      completionHandler:^(BOOL granted, NSError * _Nullable error) {
                        // Enable or disable features based on authorization.
                        [[Appboy sharedInstance] pushAuthorizationFromUserNotificationCenter:granted];
                      }];

关于ios - iOS 应用程序图标上未显示角标(Badge),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58811541/

相关文章:

ios - 事件监视器显示我的 CPU 使用率超过 100% ???(iOS)

android - 将 iOS 枚举转换为 Android

ios - UNNotificationServiceExtension 有时不运行

apple-push-notifications - 在 iOS 13 设备中无法在后台/挂起状态下接收 VoIP 消息

ios - React Native 和美国导出法规

ios - 无法更改 SKView 背景颜色

ios - URLWithString:即使使用正确的URL构造,也返回nil

apple-push-notifications - 在多个苹果 channel 中使用 PushSharp

java - 通过 Java 与 Apple 推送通知服务器进行 SSL 握手

php - APNS JSON PAYLOAD - 更多参数