对启动后推送通知传送失败进行故障排除 [英] Troubleshooting post-boot push notification delivery failures
问题描述
如果在后台和强制关闭时每次启动至少运行一次,我的应用程序会成功接收推送通知(感谢 PushKit).
My app receives push notifications successfully if run at least once per boot both in the background and when force closed (thanks to PushKit).
如果我重新启动设备,我不会收到任何推送,直到我启动应用程序至少一次.
If I reboot the device, I won't receive any pushes until I launch the app at least once.
我怎样才能让这个场景发挥作用?我正在运行最新的 Xcode 和 iOS (8.3)
How can I get this scenario working? I'm running latest Xcode and iOS (8.3)
如果我在重启设备时让应用程序在后台运行,该应用程序仍会显示在最近的菜单中,但不会收到推送,也不会命中 AppDelegate 入口点(无论如何我都有).
If I leave the app running in the background when I reboot the device, the app still shows up in the recents menu however no pushes are received and no AppDelegate entry points are hit (that I have anyways).
- 启用所有推送/通知权限以及
后台应用刷新
- 启用后台模式功能(VoIP、推送、获取)
推荐答案
问题是应用在回调更新凭据之前进入休眠状态.
The problem was that the app was going dormant before the callback to update credentials.
解决方案是在 didLaunchWithOptions
中启动后台任务,并在 didUpdatePushCredentials
函数中结束后台任务.
The solution was to start a background task in didLaunchWithOptions
and end the background task in the didUpdatePushCredentials
function.
这篇关于对启动后推送通知传送失败进行故障排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!