复位urbanairship徽章计数 [英] Reset urbanairship badge count
问题描述
问题:
- 让说我得到3通知。
- 这显示了我的应用程序图标徽章点数为3。
- 我打开应用程序或单击通知,并将其清除徽章
(所有好为止) - 现在,当我得到一个新的通知,徽章计数显示在我的应用程序
图标是4,而不是1 - 这意味着,徽章计数不重置Urbanairship结束
我的code迄今:
-(void)resetBadgeNotifications:(UIApplication *)application using:(NSDictionary *)notificationInfo{
if( notificationInfo != nil ){
[[NSNotificationCenter defaultCenter] postNotificationName:@"newNotification" object:notificationInfo];
}
application.applicationIconBadgeNumber=1;
application.applicationIconBadgeNumber=0;
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
[application cancelAllLocalNotifications];
[[UAPush shared] setBadgeNumber:1];//set to 1
[[UAPush shared] resetBadge];//zero badge
}
我从以下三个地方调用这个方法:
I am calling this method from the following three places:
didFinishLaunchingWithOptions
didRegisterForRemoteNotificationsWithDeviceToken
applicationDidBecomeActive
在我的函数的最后一行,我清楚地重新上UrbanAirship徽章。但它似乎不工作。任何人都可以请,如果我失去了一些东西指正?
In the last line of my function, I am clearly resetting the badge on UrbanAirship. But it seems to be not working. Can anyone please correct me if I am missing something?
推荐答案
我原来的答复是由APNS提供的基本推送通知。
我不知道,UrbanAirship有一个机制来追踪每个令牌的证件号码。
阅读他们的文档,它可能是你忘了打电话:
My original answer was for the basic push notifications offered by APNS. I wasn't aware that UrbanAirship have a mechanism to track the badge number for each token. Reading their documentation, it's possible that you forgot to call:
[UAPush共享] setAutobadgeEnabled:YES]
如果您的应用程序使用城市飞艇的autobadge功能,使
客户端autobadge跟踪在
应用中:didFinishLaunchingWithOptions:改变之前徽章
值:
If your application uses Urban Airship’s autobadge feature, enable client-side autobadge tracking in application:didFinishLaunchingWithOptions: before changing the badge value:
[UAPush共享] setAutobadgeEnabled:YES]; [UAPush分享]
resetBadge]; //零徽章
[[UAPush shared] setAutobadgeEnabled:YES]; [[UAPush shared] resetBadge];//zero badge
这篇关于复位urbanairship徽章计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!