如何关闭iOS上的特定通知类型

如何关闭iOS上的特定通知类型,ios,cocoa-touch,apple-push-notifications,Ios,Cocoa Touch,Apple Push Notifications,在我的应用程序的第一个版本中,我注册了: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge). 我就是这样做的: UIUserNotificationType userNotificationTypes = (UIRemoteNotificationTypeAlert | UIRemoteNoti

在我的应用程序的第一个版本中,我注册了:

(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];
我原以为从现在起徽章通知会被关闭。当我进入设置菜单并检查我的应用程序的通知设置时。badge的切换开关不见了,但badge编号仍在更新中


我怀疑我的方法只是未注册UIRemoteNotificationTypeBadge,而不是关闭它。有没有办法做到这一点?谢谢

我不确定为什么没有关闭徽章通知,但是如果您决定放弃徽章通知,可以在服务器端禁用它们。简单地说,不要在正在发送的推送通知的JSON负载中发送徽章号


即使您成功地在客户端禁用了徽章通知,您仍然应该在服务器端禁用它,以免在计算和发送客户端不使用的数据时浪费CPU和带宽。

谢谢。这将是我最后的选择,但我仍然好奇是否有办法关闭它。