调用unregisterForRemoteNotifications后,registerForRemoteNotifications不起作用 [英] registerForRemoteNotifications is not working after calling unregisterForRemoteNotifications
问题描述
[[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屋!