On iOS, how can my app get the notification data that it received while the phone was in the background?

前端 未结 4 530
醉梦人生
醉梦人生 2021-01-24 06:52

Is there a way in AppDelegate to get a queue of all the notification data? (Once the user opens the app).

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-24 07:22

    As per apple documentation:

    When a remote notification arrives, the system calls the application:didReceiveRemoteNotification:fetchCompletionHandler: method. Notifications usually signal the availability of new information. In your app delegate method, you might begin downloading new data from a server so that you can update your app’s data structures. You might also use the notification to update your user interface.

    You have to enable remote notification background mode, only then you will get a callback to the above mentioned method.

提交回复
热议问题