Help. Check for Invalid Device Token?

Discussion in 'iOS Programming' started by cthesky, Dec 5, 2011.

  1. cthesky macrumors member

    Joined:
    Aug 21, 2011
    #1
    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. :)
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    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 :)
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    You'll want to read about the Feedback Service in the Guide for push notifications.
     

Share This Page