简体   繁体   English

UILocalNotification repeatInterval + applicationIconBadgeNumber

[英]UILocalNotification repeatInterval + applicationIconBadgeNumber

I'm trying to schedule repeating local notifications and set the application badge number to the actual number of notifications that have been scheduled so far at any given moment. 我正在尝试安排重复的本地通知,并将应用程序徽章号设置为到目前为止在任何给定时刻已安排的实际通知数。

Since there's apparently no way to set a different badge number for each occurrence of the notification, I can see only 3 solutions: 由于显然无法为每次通知设置不同的徽章编号,因此我只能看到3种解决方案:

  • Ignore the repeatInterval property of the notification and schedule separate notifications myself (see here ). 忽略通知的repeatInterval属性,并自己安排单独的通知(请参阅此处 )。 The thing is, since the system holds only 64 notifications per application, I may miss notifications if the user taps "dismiss" too many times, especially if several notifications are active. 事实是,由于系统每个应用程序仅包含64条通知,因此如果用户多次点击“关闭”,我可能会错过通知,尤其是在多个通知处于活动状态时。

  • Show an incorrect badge number (1 for each unique notification, regardless of the number of times this notification has been repeated so far). 显示不正确的徽章编号(每个唯一的通知1,无论到目前为止已重复此通知的次数)。

  • Not use a badge at all. 完全不使用徽章。

Am I missing something, or are these the only 3 options? 我是否想念一些东西,还是只有3种选择?

Looks like those are your options, since the badge number property of an UILocalNotification does not increment the current applicationIconBadgeNumber but just set it's these are your options. 看起来这些是您的选择,因为UILocalNotification的badge number属性不会增加当前的applicationIconBadgeNumber而只需对其进行设置即可。

Also keep in mind that when going with option 1 your have a maximum of 64 notifications that can be set, but you know that already ;) 还请记住,使用选项1时,您最多可以设置64个通知,但是您已经知道了;)

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

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