在设置应用程序中禁用它们后继续接收 iOS 推送通知 [英] Keep receiving iOS push notifications after disabling them in settings app

查看:26
本文介绍了在设置应用程序中禁用它们后继续接收 iOS 推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中测试远程推送通知期间,我遇到了一些奇怪的行为:

During the testing of remote push notifications in my App I faced some strange behavior:

即使我在设置 App.这是正常的吗?禁用该选项后,我的应用程序应该取消订阅通知本身,还是 iOS 的响应?或者我应该在注册远程通知时做一些特别的事情吗?或者对于沙盒"通知来说可能是正常的?

I keep getting notifications even if I turn off the "notifications enabled" for my application option in settings App. Is that normal? Should my App unsubscribe from getting notifications itself after disabling that option, or it is response of iOS? Or should I do something special when registering for remote notifications? Or maybe its normal for "sandbox" notifications?

在 iPhone 4 上的 iOS 5.1 上测试.

Tested on iOS 5.1 on iPhone 4.

推荐答案

我认为禁用通知的 UI 令人困惑.将通知中心"切换为关闭与禁用通知不同.

The UI for disabling notifications is confusing, I think. Switching 'Notification Centre' to OFF is not the same as disabling notifications.

您都需要单独取消选择警报样式"、徽章应用图标"、声音"和在锁定屏幕中查看".

You all need to deselect the 'Alert Style', the 'Badge App Icon', 'Sounds', and 'View in Lock Screen - all individually.

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

Here's the code I use to examine the notification settings at run-time:

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");
    }
}

这篇关于在设置应用程序中禁用它们后继续接收 iOS 推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆