继续在设置应用程序中禁用iOS推送通知

在我的应用程序的远程推送通知testing期间,我面对一些奇怪的行为:

即使我在设置应用程序中closures了我的应用程序选项的“启用通知”,我仍然收到通知。 这是正常的吗? 禁用该选项后,我的应用程序是否应取消订阅通知本身,或者是iOS的响应? 还是应该在注册远程通知时做一些特别的事情? 或者,也许正常的“沙盒”通知?

在iPhone 4上testingiOS 5.1。

禁用通知的用户界面令人困惑,我想。 将“通知中心”切换为OFF与禁用通知不同。

您都需要取消select“警示风格”,“徽章应用程序图标”,“声音”和“在locking屏幕中查看 – 全部单独。

下面是我用来在运行时检查通知设置的代码:

UIRemoteNotificationType notificationSelection = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; BOOL sendMessage; if (notificationSelection == UIRemoteNotificationTypeNone) { NSLog(@"Push Notifications : DISABLED (%0X)!", notificationSelection); sendMessage = NO; } else { NSLog(@"Push Notifications : ENABLED (%0X) - hurrah! :-)", notificationSelection); if (notificationSelection & UIRemoteNotificationTypeBadge) { NSLog (@"Push Notifications : Badge"); } if (notificationSelection & UIRemoteNotificationTypeSound) { NSLog (@"Push Notifications : Sound"); } if (notificationSelection & UIRemoteNotificationTypeAlert) { NSLog (@"Push Notifications : Alert"); } if (notificationSelection & UIRemoteNotificationTypeNewsstandContentAvailability) { NSLog (@"Push Notifications : Newstand Content Availability"); } }