设置本地通知applicationIconBadgeNumber

时间:2012-03-02 13:55:48

标签: iphone uilocalnotification

当我设置localnotification的applicationIconBadgeNumber时,我是否只放1,知道它将添加到总数中,还是我把总数添加?

e.g。

UILocalNotification *localNotif2 = [[UILocalNotification alloc] init];

localNotif2.applicationIconBadgeNumber = 1;   

OR

UILocalNotification *localNotif2 = [[UILocalNotification alloc] init];

localNotif2.applicationIconBadgeNumber = Total;

(但是,我无法预测用户在任何给定时间内阅读的通知总数...这意味着,如果第二种方法是真的,那么我已经搞砸了。)< / p>

2 个答案:

答案 0 :(得分:3)

第二个是真的。始终设置总值。每次打开应用程序时都必须重新计算所有的通知。

此外,文档说明The application should use this property’s value to increment the current icon badge number, if any.,它不会自行递增。

答案 1 :(得分:-1)

这是不可能的,你可以从你的代码中处理它。