简体   繁体   English

iOS Azure推送通知应用程序徽章

[英]iOS azure push notification application badge

I am setting UIUserNotificationTypeBadge in UIUserNotificationSettings but still the badge doesn't appear on the app when a notification arrives. 我设置UIUserNotificationTypeBadgeUIUserNotificationSettings ,但仍当通知到达徽章不上的应用程序出现。
What might be the reason and in that case the solution for this. 原因可能是什么,在那种情况下是解决方案。

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

You need to set the badge value in your Notification payload. 您需要在“通知”有效负载中设置徽章值。

Here is the sample code that will set the badge to 5. 这是将徽章设置为5的示例代码。

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

You can learn more about the payload here. 您可以在此处了解有关有效负载的更多信息。 https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM