iOS Help. Check for Invalid Device Token?

cthesky

macrumors member
Original poster
Aug 21, 2011
91
0
Hi all,

I am developing an Iphone Application which implements Apple Push Notification service (APNs). Everytime my application launch, it will send a device token to a server and store in a database in server.

But if a user migrate to new device or reinstall operating system, the device token will change, and when run application, the application will launch again and send a new device token to server. But the previous device token it sent to server will become invalid (the device token sent to server before reinstall operating system will become invalid and no longer exist but still store in my database in server) ... Server (provider) will send notification to client based on the device tokens stored in database ...

So, how can I check for those invalid device token? How can I check those device token which already not exist? This is because I need delete those invalid device token from database to prevent server send notification to them... Is it using "Enhanced Notification Format" to check for status code in error-response packet return by APNs when APNs finds an error? I need to do the checking of invalid device token in server side? or client side?

Anyone have any ideas? Any suggestions and comments are welcome and appreciated. :)

Thanks a lot. :)
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
If you read the documentation well, you would've seen Apple sends error codes back if there is something wrong like, Device Token not avaiable anymore etc.
On your backend you can respond to that, and delete them :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.