推送通知徽章没有出现?

Cal*_*l S 4 iphone cocoa-touch push-notification

我正在使用Urban Airship向我的应用发送推送通知

例如:

{"aps": {"badge": 2, "alert": "Part 2 of the August Issue is ready to download!", "sound": "default"}, "device_tokens": ["X"]}
Run Code Online (Sandbox Code Playgroud)

警报将完美显示,但无论我设置"徽章",应用图标都不会被标记:#to ...

我的有效负载是否不正确或是否有额外的代码我应该添加到我的应用程序来处理徽章和警报?谢谢!

编辑:我正在注册这样的推送通知:

// Register for notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeNewsstandContentAvailability | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert)];
Run Code Online (Sandbox Code Playgroud)

Jir*_*eta 6

我遇到了类似的问题.几分钟后检查一下.我注意到我的服务器端代码存在问题.我发现必须将徽章值隐式设置为整数才能获得所需的结果.希望能帮助任何人阅读本文.

  • 我想这意味着它应该传递为4而不是"4". (2认同)