【发布时间】:2015-01-30 01:53:55
【问题描述】:
在我的应用的第一个版本中,我注册了它:
(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge).
我就是这样做的:
UIUserNotificationType userNotificationTypes = (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
现在在我的应用程序的第二个版本中,我决定通过再次注册通知来放弃徽章通知:
UIUserNotificationType userNotificationTypes = (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
我原以为从现在开始会关闭徽章通知。当我进入设置菜单并检查我的应用程序的通知设置时。徽章的切换开关不见了,但徽章编号仍在更新。
我怀疑我的方法只是未注册 UIRemoteNotificationTypeBadge,但没有将其关闭。有没有办法做到这一点?谢谢!
【问题讨论】:
标签: ios cocoa-touch apple-push-notifications