0

I got device tokens in my DB and I am trying to check if particular device token is for sandbox mode or for production mode.

Thanks.

Naveed Rafi
  • 2,503
  • 5
  • 32
  • 40

1 Answers1

0

You should try to send a notification with that device token to the sandbox APNS server (using the sandbox push certificate). Then you should try to read from the socket. If you read an error response with error code 8, that means the device token is invalid in the sandbox env (which means it's probably a production token).

Eran
  • 387,369
  • 54
  • 702
  • 768
  • trying would be very costly if one is going to send push to around 1k people. I want to know if there is any way to check if this particular token is from sandbox or production by using some calculations or something. – Naveed Rafi Apr 19 '14 at 06:04
  • @NaveedRafi There is no other way. A 1000 pushes are a small number, so it won't be very costly. And assuming that both tokens in your DB are production tokens (since you probably didn't use many devices while testing the app in sandbox env), testing them by sending push to sandbox env will actually send notifications only to devices where the development build is still installed, which means very few devices would actually get this push. – Eran Apr 19 '14 at 13:20