So this is my first time developing an app that uses APN. I ended up mixing development and production device tokens. Apparently, the APNS ignores notifications that include development tokens when using a product certificate. Does anyone know of a way that I could identify which tokens are invalid (development device token) so that I could remove them from my server?
4
votes
check this question stackoverflow.com/questions/1278834/…
– Omar Abdelhafith
i tried that.. it's not returning any results as it seems that quite a large number of tokens need to be invalid before feedback is given. I don't think there's an automatic way except for manually checking tokens by date and remove those before launch... quite a funny and stupid solution which might not work though
– ChrisBorg
1 Answers
2
votes
You identify such invalid device tokens by using the enhanced message format to send the notifications to Apple, and trying to read from the socket in order to get the error responses. An invalid device token will cause an error response to be written by Apple to the socket before they close it. The tricky part is managing to read the error response before the socket is closed.
This Technical Note gives a good explanation.