Push notifications - catching them?

2019-02-18 17:40发布

问题:

okay, so here is the deal.

my app is using iOS notifications. in app delegate I am catching them in didReceiveRemoteNotification if the app is in foreground i catch it in didBecomeActive if app was in background and i tapped on the push notification.

however!

if my app is in background, i receive push notification and if i do not tap on push notifications (or just "Cancel" on it in iOS less than 5.0), and open app in say, couple minutes, i can't figure out how do I find this push notification. any suggestions?

thanks!

回答1:

If your app is in background the OS handles the push notifications. It sets a badge, shows a text or plays a sound. You even can specify a launch image in iOS5 what the app launches with when "OK" is pressed.

However if you do not press OK or cancel the notification PopUp, there is no chance to catch any information.

If you send your notifications from an application server, you could implement an interface (REST or such) on that server which can be asked for the last notification or even the notification history. But that is a workaround.