请设置应用程序禁用后,他们收到的iOS推送通知 [英] Keep receiving iOS push notifications after disabling them in settings app

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

问题描述

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

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

我不断收到通知,即使我关掉在设置应用我的应用程序选项中的启用通知。这是否正常?如果我的应用程序从禁用该选项后,收到通知本身退订,或者它的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?

测试在iOS 5.1的iPhone 4。

Tested on iOS 5.1 on iPhone 4.

推荐答案

禁用通知用户界面是混乱的,我想。开关通知中心为OFF是不一样的禁用通知。

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.

这里的code我用它来检查在运行时的通知设置:

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天全站免登陆