IOS unregisterForRemoteNotifications不会在飞行模式下工作 [英] IOS unregisterForRemoteNotifications does not work in airplane mode

查看:699
本文介绍了IOS unregisterForRemoteNotifications不会在飞行模式下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个我的应用程序的功能,才能从远程pushnotification注销用户时,从应用程序用户登录超时。有没有办法,当用户注销,而该设备处于飞行(离线)模式,我可以从注销推送通知应用程序?

One of the feature in my app is to unregister user from the remote pushnotification when user logs-out from the app. Is there way I can unregister the app from push notification when user logs out while the device is in airplane(offline) mode?

我想这code,但我仍然收到通知,当我回来在网上,
[UIApplication的sharedApplication] unregisterForRemoteNotifications];

I tried this code but I still receive notifications when I come back online, [[UIApplication sharedApplication] unregisterForRemoteNotifications];

能有人帮助如何从通知中心当设备处于飞行模式删除应用程序?

Could some one help how to remove app from notification center when the device is in airplane mode?

推荐答案

苹果控制远程推送通知。如果你下线,你在逻辑上无法禁用它。当苹果公司第一次看到你在网上和推未被禁用,它会送你推。有没有办法从显示,苹果公司发送给用户的推停止的iDevice,因为它不是在应用程序的手中。

Apple controls remote push notifications. If you are offline you logically cannot disable it. When Apple first sees you online and pushes are not disabled, it will send you pushes. There is no way to stop the iDevice from showing the pushes that apple sends to the user, as it is not in the hands of the app.

那么只有一种可能:你必须立即禁用推后设备重新上线。而且它毕竟是一个运气的问题,什么消息苹果获得第一,你是在网上或禁用推送。同时也存在这样的问题,会发生,苹果想要发送到设备,而这是离线通知的内容。它会重新发送在线反正他们何时或丢弃先禁用的时候?我不知道。你需要做的研究工作。

So there is only one possibility: You have to disable the pushes IMMEDIATELY after the device went online again. And still it is a question of luck, what message Apple obtains first, that you are online or that you disable push. And also there is the question, what will happen to the notifications that Apple wanted to send to the device while it was offline. Will it resend them anyway when online or discard them when disabling first? I don't know. You'll need to do the research.

所以你唯一的机会是,如果您的应用程序在后台,而用户上线。你需要prevent从被暂停您的应用程序(<一个href=\"http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html\"相对=nofollow>这里的的怎么实现),以便能够对系统通知作出回应。你需要通知是在线状态的变化,我只知道它的存在。 此资源可能会有所帮助。当设备进入网络,因此它会通知你的应用程序,它等待在后台(不暂停)。然后,你可以通过注销FRM远程反应就会立即将

So the only chance you have is if your app is in the background while the user goes online. You'll need to prevent your app from getting suspended (here's how to achieve that) in order to be able to respond to system notifications. The notification that you need is that of change of online status, I only know it exists. This resource may be helpful. When the device goes online it therefore will notify your app which waits in the background (not suspended). Then you can react by unregistering frm remote pushes immediately.

这是你可能会在这个方向达到最佳状态。希望这有助于。

That's the best you possibly could achieve in that direction. Hope this helps.

这篇关于IOS unregisterForRemoteNotifications不会在飞行模式下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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