Reputation: 4914
In the scenario where a user did not swipe a push notification before it disappeared, is there any way to retrieve the last one sent to the device for my app? I can go into the notification center and see the last few push notifications for my app there, is there any way I can retrieve the last one when my app opens?
Upvotes: 2
Views: 459
Reputation: 53870
There is no way to retrieve past push notifications.
Typically, this isn't needed. Once launched, your app can communicate with your server to see what's new.
If the app is launched from a notification, your app will receive the push notification passed in as an option with the key UIApplicationLaunchOptionsRemoteNotificationKey
to the app delegate method application:didFinishLaunchingWithOptions
.
If your app is running and in the foreground when the push notification arrives, the app delegate application:didReceiveRemoteNotification
will be called
With iOS 7 and later, if the notification type is content-available
and you have the Background App Refresh capability turned on (and the user has not disabled Background App Refresh), then an app in the background will also get application:didReceiveRemoteNotification
Upvotes: 3