【问题标题】:Urban Airship iOS Badges not resetting to 0Urban Airship iOS 徽章未重置为 0
【发布时间】:2014-05-19 22:32:37
【问题描述】:

教程"Here" 有点混乱,所以想知道是否有人已经实现了这个。该应用正在使用“UA's autobadge”功能,并且在应用打开时会清除徽章编号,但不会重置为 0。因此,当有新通知到达时,它会永远增加徽章编号。

我在didFinishLaunchingWithOptions 中的代码是:

UAConfig *config = [UAConfig defaultConfig];
[config setAutomaticSetupEnabled:NO];
[[UAPush shared] setNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
[[UAPush shared] registerForRemoteNotifications];
[UAirship takeOff:config];
[[UAPush shared] setAutobadgeEnabled:YES];
[[UAPush shared] resetBadge];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

我做错了什么微不足道的事情吗?有没有人解决这个问题?

提前致谢!

【问题讨论】:

    标签: ios objective-c apple-push-notifications urbanairship.com


    【解决方案1】:

    我有这个,一旦阅读消息,它就会清除徽章:

    - (void)applicationWillResignActive:(UIApplication *)application{
    // Set the application's badge to the number of unread messages
    if ([UAInbox shared].messageList.unreadCount >= 0) {
        [[UIApplication sharedApplication] setApplicationIconBadgeNumber:[UAInbox shared].messageList.unreadCount];
    }}
    

    【讨论】:

      猜你喜欢
      • 2016-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多