IOS – How long do Apple retain notifications to be pushed to iOS devices until they expire

apnsiosnotifications

If an app attempts to send a notification to an iOS device that is either powered off or has no network connectivity push notifications need to be kept in queue.

For how long does Apple retain notifications to allow the device time to contact the APNS servers?

Best Answer

What you are referring to is covered under Quality of Service component of Apple push notifications. It's addressed in the following linked Apple Developer documentation:

Apple Push Notification service includes a Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification and the destination device is offline, APNs stores the notification for a limited period of time and delivers it when the device becomes available again. This component stores only the most recent notification per device and per app. If a device is offline, sending a notification request targeting that device causes the previous request to be discarded. If a device remains offline for a long time, all its stored notifications in APNs are discarded.

and

apns-expiration

A UNIX epoch date expressed in seconds (UTC). This header identifies the date when the notification is no longer valid and can be discarded.

If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time. If the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it.


Referring the Local and Remote Notification Programming Guide should address your concerns related to Apple push notifications.