Skip to content

APNs Delivery Failure Handling

ileitch edited this page Sep 7, 2014 · 1 revision

The APNs provides two mechanism for delivery failure notification:

Immediately, when processing a notification for delivery.

Although rpush makes such errors highly unlikely due to validation, the APNs reports processing errors immediately after being sent a notification. These errors are all centred around the well-formedness of the notification payload. Should a notification be rejected due to such an error, rpush will update the following attributes on the notification:

failed flag is set to true. failed_at is set to the time of failure. error is set to Apple's code for the error. error_description is set to a (somewhat brief) description of the error.

rpush will not attempt to deliver the notification again.

The Feedback Service

rpush checks for feedback periodically and stores results in the Rpush::Apns::Feedback model. Each record contains the device token and a timestamp of when the APNs determined that the app no longer exists on the device.

It is your responsibility to avoid creating new notifications for devices that no longer have your app installed. rpush does not and will not check Rpush::Feedback before sending notifications.

In order to receive feedback from the sandbox environment you will need to have a second app installed on your device that is connected to the sandbox notification servers. See Technical Note TN2265 (Issues with Using the Feedback Service) - http://developer.apple.com/library/ios/#technotes/tn2265/_index.html

Note: In my testing and from other reports on the Internet, it appears you may not receive feedback when using the APNs sandbox environment.

You can define a callback to run every time feedback is received, see Configuration.