故障排除后启动推送通知传递失败

时间:2021-05-23 16:22:40

My app receives push notifications successfully if run at least once per boot both in the background and when force closed (thanks to PushKit).

我的应用程序成功接收推送通知,如果在后台和强制关闭时每次启动至少运行一次(感谢PushKit)。

If I reboot the device, I won't receive any pushes until I launch the app at least once.

如果我重新启动设备,在我至少启动一次应用程序之前,我不会收到任何推送。

How can I get this scenario working? I'm running latest Xcode and iOS (8.3)

我怎样才能使这个场景有效?我正在运行最新的Xcode和iOS(8.3)


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).

如果我在重新启动设备时让应用程序在后台运行,应用程序仍会显示在最近的菜单中,但是没有收到任何推送且没有命中AppDelegate入口点(我仍然有)。

  • All push/notification permissions are enabled as well as Background App Refresh
  • 启用所有推送/通知权限以及后台应用刷新

  • Background Mode Capabilities are enabled (VoIP, push, fetch)
  • 后台模式功能已启用(VoIP,推送,提取)

1 个解决方案

#1


The problem was that the app was going dormant before the callback to update credentials.

问题是应用程序在更新凭据的回调之前处于休眠状态。

The solution was to start a background task in didLaunchWithOptions and end the background task in the didUpdatePushCredentials function.

解决方案是在didLaunchWithOptions中启动后台任务,并在didUpdatePushCredentials函数中结束后台任务。

#1


The problem was that the app was going dormant before the callback to update credentials.

问题是应用程序在更新凭据的回调之前处于休眠状态。

The solution was to start a background task in didLaunchWithOptions and end the background task in the didUpdatePushCredentials function.

解决方案是在didLaunchWithOptions中启动后台任务,并在didUpdatePushCredentials函数中结束后台任务。