调用unregisterForRemoteNotifications后,registerForRemoteNotifications不起作用 [英] registerForRemoteNotifications is not working after calling unregisterForRemoteNotifications

查看:489
本文介绍了调用unregisterForRemoteNotifications后,registerForRemoteNotifications不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[[UIApplication sharedApplication] registerForRemoteNotifications];

呼叫

无法正常工作

[[UIApplication sharedApplication] unregisterForRemoteNotifications];

知道为什么吗? 官方文件评论说:通过此方法取消注册的应用程序始终可以重新注册.

解决方案

您应该只卸载应用程序并删除该代码!

也不要取消注册远程通知.这显然不是一个好方法.因此,请修改此行:-

[[UIApplication sharedApplication] unregisterForRemoteNotifications]

这会将应用置于不稳定状态,在该状态下调用registerForRemoteNotifications不再起作用.

您只需在代码中调用一次即可.

[[UIApplication sharedApplication] registerForRemoteNotifications]

[[UIApplication sharedApplication] registerForRemoteNotifications];

is not working after calling

[[UIApplication sharedApplication] unregisterForRemoteNotifications];

any idea why? official document commented that:Apps unregistered through this method can always re-register.

解决方案

You should just Uninstall the app and delete that code!

Also do not unregister the remote notifications. This is obviously not a good way to do.So revue this line :-

[[UIApplication sharedApplication] unregisterForRemoteNotifications]

It puts the app in an unstable state where calling registerForRemoteNotifications no longer works.

All you have to call it once in your code.

[[UIApplication sharedApplication] registerForRemoteNotifications]

这篇关于调用unregisterForRemoteNotifications后,registerForRemoteNotifications不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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