gpt4 book ai didi

iOS - 当应用程序被用户强制退出时处理静默推送通知

转载 作者:可可西里 更新时间:2023-11-01 03:34:21 24 4
gpt4 key购买 nike

我目前在 iOS 中遇到推送通知问题。

我的应用程序收到包含标识符的静默推送通知。然后使用此标识符从创建本地通知的远程服务器获取数据。

据我所知,如果用户强制退出应用程序(即通过双击主页按钮并滑动关闭应用程序),则静默推送通知不会传递到 didReceiveRemoteNotification AppDelegate 类 [1] [2] 中的方法,从而阻止应用程序进行任何类型的处理。

我已经对处理上述情况进行了大量研究。但是,无法找到明确的答案,希望有人能帮助我或指出正确的方向。

TLDR:如果用户强制退出了我的应用,但我仍需要处理静默通知,我该怎么办?

更多信息:
我的应用只需要支持 iOS8+。

[1] https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1

The Notification Payload
If the target app isn’t running when the notification arrives, the alert message, sound, or badge value is played or shown. If the app is running, the system delivers the notification to the app delegate as an NSDictionary object.

[2] https://stackoverflow.com/a/19202487/2472819

最佳答案

以前在 iOS 7 及之前,一旦用户强行退出一个应用程序,它将无法运行和后台任务,包括位置监控,使用 content-available:1

但是问题是没有记录这种行为。原因是它可能会在新的 iOS 更新中发生变化,Apple 不想过早地钉棺材。与 iOS 8 一样,引入了 PushKit 并且应该能够处理强制退出场景。详情请查看本教程:https://zeropush.com/guide/guide-to-pushkit-and-voip

关于iOS - 当应用程序被用户强制退出时处理静默推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29907388/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com