简体   繁体   English

iOS - 处理应用程序时处理静默推送通知

[英]iOS - Handling Silent Push Notifications When App Is Killed

I am currently facing a problem with push notifications in iOS. 我目前在iOS中遇到推送通知问题。

My app receives silent push notifications containing an identifier. 我的应用程序收到包含标识符的静默推送通知 This identifier is then used to fetch data from a remote server from which a local notification is created. 然后,此标识符用于从创建本地通知的远程服务器获取数据。

As far as I'm aware, if the user has force-quit an app (ie by double tapping the home button and swipe closing the app) then the silent push notification does not get passed onto the didReceiveRemoteNotification method in the AppDelegate class [1] [2], thus preventing the app from doing any kind of processing. 据我所知,如果用户强制退出应用程序(即通过双击主页按钮并轻扫关闭应用程序),则无提示推送通知不会传递到AppDelegate类中的didReceiveRemoteNotification方法[1 ] [2],从而阻止应用程序进行任何类型的处理。

I have done a fair amount of research into handling the situation mentioned above. 我已经对处理上述情况做了大量研究。 However, was unable to find a definitive answer and was hoping someone could help me out or point me in the right direction. 然而,无法找到明确的答案,并希望有人可以帮助我或指出我正确的方向。

As documented - application:didReceiveRemoteNotification:fetchCompletionHandler: by Apple, there is not much you can do: 正如文档所述- application:didReceiveRemoteNotification:fetchCompletionHandler: Apple,你可以做的事情并不多:

However, the system does not automatically launch your app if the user has force-quit it. 但是,如果用户强行退出,系统不会自动启动您的应用。 In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again. 在这种情况下,用户必须重新启动应用程序或重新启动设备,然后系统才会再次尝试自动启动应用程序。

It is done so that users could stop unwanted notifications 这样做是为了让用户可以阻止不需要的通知

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM