gpt4 book ai didi

iOS 天蓝色推送通知应用程序角标(Badge)

转载 作者:行者123 更新时间:2023-11-28 21:27:15 26 4
gpt4 key购买 nike

我在 UIUserNotificationSettings 中设置了 UIUserNotificationTypeBadge,但是当通知到达时,badge 仍然没有出现在应用程序上。
可能是什么原因以及在这种情况下的解决方案。

UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeSound |
UIUserNotificationTypeAlert | UIUserNotificationTypeBadge categories:nil];

最佳答案

您需要在通知负载中设置角标(Badge)值。

这是将角标(Badge)设置为 5 的示例代码。

{
"aps" : {
"alert" : {
"title" : "Game Request",
"body" : "Bob wants to play poker"
},
"badge" : 5
}

您可以在此处了解有关负载的更多信息。 https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html

关于iOS 天蓝色推送通知应用程序角标(Badge),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37585083/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com