Skip to content
This repository has been archived by the owner on Mar 9, 2018. It is now read-only.

APNs Delivery Failure Handling

perezda edited this page May 15, 2013 · 2 revisions

The APNs provides two mechanism for delivery failure notification:

Immediately, when processing a notification for delivery.

Although rapns 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, rapns will update the following attributes on the notification and send a notification via Airbrake/Hoptoad (if enabled):

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.

rapns will not attempt to deliver the notification again.

The Feedback Service

rapns checks for feedback periodically and stores results in the Rapns::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. rapns does not and will not check Rapns::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.