移除];远程通知"从通知中心 [英] Remove "remote notifications" from notification center

查看:314
本文介绍了移除];远程通知"从通知中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:我的应用收到来自自己的服务器上一些偏远的通知只是为了显示给用户,我没有使用图标徽章一些实用的信息,因为我并不需要它,如果应用程序的用户触摸从iOS的通知中心远程通知我的应用程序可以捕获它没有任何问题,我收到来自选项的application:didFinishLaunchingWithOptions:或者,如果应用程序打开我赶上了didReceiveRemoteNotification:选择但是现在我想删除从iOS的通知中心,这些通知,因为它只是一个消息,我一直在寻找的答案与应用程序的远程通知另一个职位,我试着在我的应用程序,这些解决方案和他们不工作

I have the following issue: "My app receive some remote notifications from an own server just to show to the user some practical information. I am not using a icon badge, because I don't need it. If the application user touch the remote notification from the iOS Notification Center my application can catch it without any problem, I receive the options from application:didFinishLaunchingWithOptions: or, if the application is open I catch the remote notification with application:didReceiveRemoteNotification: selector. But, now I want to remove these notifications from iOS Notification Center because It is just a message and I have been looking for the answer in another posts and I've tried these solutions in my app and they don't work"

一些解决方案是接下来的:

Some solutions were the next:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {  
    [application cancelAllLocalNotifications];  
    application.applicationIconBadgeNumber = 0;  
    ...  
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  
    ...  
    if (launchOptions) {  
        [application cancelAllLocalNotifications];  
        application.applicationIconBadgeNumber = 0;  
    }  
    ...  
}

和远程通知仍然在iOS的通知中心,我怎么能离开该场所删除没有任何棘手的code或者是iOS的SDK问题?我不认为一个问题是可能的,因为Tweetbot应用程序的iOS从通知中心,你进入到应用程序后,删除其远程通知。

And the remote notification still in the iOS Notification Center, how can I remove from that place without any tricky code or is an iOS SDK issue? I don't think that an issue was possible because Tweetbot app remove its remote notifications from iOS Notification Center after you enter to the app.

祺!

推荐答案

首先要确保你没有设置标志通知在控制面板熄灭(我注意到,如果徽章有很多,首先,然后徽章在控制面板关闭时,它不能被设置为0)。

First of all make sure you haven't set badge notification to be off in the control panel (I noticed that if the badge has a number to begin with, then badging is turned off in the control panel, it cannot be set to 0).

如果其未关闭,那么除了applicationIconBadgeNumber设置为0,还尝试取消所有本地通知(即使你没有任何排队,如果您已经得到他们的名单,然后取消它们,然后将它们注册再次回来)。是清除当地的通知,可以对能够清除徽章号码远程通知的效果。

If its not turned off then in addition to setting applicationIconBadgeNumber to 0, also try canceling all local notifications (even if you haven't queued any, if you have first get a list of them, then cancel them, then register them back again). Yes clearing local notifications can have an effect on being able to clear the badge number for remote notifications.

这篇关于移除];远程通知"从通知中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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