【发布时间】:2013-09-01 22:16:09
【问题描述】:
一段时间以来,我一直在为似乎应该“正常工作”的事情苦苦挣扎。我通过 Urban Airship 设置了推送通知,除了在后台更新徽章外,一切正常。据我所知,只要在负载中将徽章设置为整数,如果应用不在前台,它应该自行处理。
如果我在应用程序处于前台时捕获徽章更新,我可以正确设置它,但这不是我想在我的应用程序中使用徽章的原因。
这是我在didFinishLaunchingWithOptions:中的设置
UAConfig *config = [UAConfig defaultConfig];
// You can also programatically override the plist values:
// config.developmentAppKey = @"YourKey";
// etc.
// Call takeOff (which creates the UAirship singleton)
[UAirship takeOff:config];
[UAPush shared].notificationTypes = (UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeNewsstandContentAvailability);
[[UAPush shared] setPushEnabled:YES];
[[UAPush shared] setAutobadgeEnabled:YES];
[self performSelector:@selector(resetUABadge:)];
[[UAPush shared] handleNotification:[launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]
applicationState:application.applicationState];
resetUABadge 调用只是在应用启动时将所有内容设置回 0。无论 performSelector 是否存在,这个问题都存在。
我不确定我是否缺少某些配置或什么,但推送通知的所有其他部分在应用程序后台/关闭(警报、声音)时工作,但徽章根本不会更新。
【问题讨论】:
-
我的应用在 [UAirship takeOff:config] 上显示错误的 Excess; 帮我解决这个问题。
标签: ios push-notification urbanairship.com badge