如何给应用程序图标一个没有数字的通知徽章? [英] How to give an app icon a notification badge without a number?

查看:22
本文介绍了如何给应用程序图标一个没有数字的通知徽章?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Apple 的本地和推送通知编程指南的第 7 页上有一张 iPhone 桌面的屏幕截图,其中一个应用程序图标有一个不包含数字的徽章 - 它只是纯红色.

On page 7 of Apple's Local and Push Notification Programming Guide there is a screenshot of the iPhone desktop, one of the application icons has a badge which does not contain a number - it is just plain red.

如何实现这一目标?

推荐答案

我认为当前的通知 API 无法实现您想要做的事情.如果你想在你的应用程序图标上显示徽章,你必须在你的 APNS 负载中使用徽章"键,并且这个键的值必须是一个整数.

I think what you want to do is not possible with the current notification API. If you want to display the badge on your application icon, you must use the "badge" key in your APNS payload, and the value for this key must be an integer.

即使本地通知 API 也有同样的限制,您可以使用 applicationIconBadgeNumber 属性更改徽章值,但不幸的是,此属性只接受整数.

Even the local notification API has the same limitation, you can change the badge value with the applicationIconBadgeNumber property but, unfortunately, this property only accepts an integer.

似乎只有内置应用(例如电话应用)才能显示没有数字的徽章.

It seems that only built-in apps (such as the phone app) can display a badge without number.

这篇关于如何给应用程序图标一个没有数字的通知徽章?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆