I have problem on Apple push notification in my backend. All my device tokens were stored in my database either development and production. During I push message to APNs, I got invalid device token message and the connection is closed. The push notification operation is never completed. Would you mind giving me the solution to identify if it's development or production device token?
Asked
Active
Viewed 1,166 times
1
-
you should actually separate your dev and prod environments – meim Dec 18 '15 at 04:43
-
What status code do you get from the APNS service? There is no way to tell from a token whether it is prod or dev. – Paulw11 Dec 18 '15 at 04:44
-
Are you using the binary provider API or the HTTP/2 API? – Paulw11 Dec 18 '15 at 04:49
-
@Paulw11: I'm using HTTP/2 API – Sophea Dec 18 '15 at 06:45
2 Answers
1
The root of your problem sounds like you're sometimes using the wrong certificate for the token - dev cert with production token etc.
Announced by Apple today that you now only need one certificate for both environments. This would mean that you're always using the correct certificate for your tokens, and might therefore fix your problem.
Obviously, as has already been stated, you need to keep your dev/production environments separate (or at least mark records as coming from one particular environment).
Hope this helps.

siburb
- 4,880
- 1
- 25
- 34
-
Thanks for your answer. This is my mistake that I didn't separate the record. – Sophea Dec 21 '15 at 03:35
0
The device token generated is decided by operating system and hence its random. We cant identify the device token environment.

Rahul Mathur
- 872
- 1
- 7
- 20