siva
siva

Reputation: 251

apns push notifications is not working with production certificate

I've enabled push notifications for my App ID and checked in development that is fine, but in production i am not getting notifications.

I used the following code in my server side.

Here are the steps I have followed when switching from production to development:

  1. used the production SSL certificate key
  2. changed the sandbox to false in above blog

I cross checked my distribution provisioning profile which contains key aps-environment and production mode

Is there any thing still I need to change, how can I cross check where I am going wrong?

I already downloaded my app from iTunes portal, but I did keep my .p12 file in my project while archiving, is it necessary?

Upvotes: 0

Views: 2435

Answers (1)

Eran
Eran

Reputation: 393781

Device tokens are different for development and production environment. Production device tokens are invalid in development environment and vica versa. You should have maintained different databased for the production tokens and development tokens. Now that you have them mixed it's a bit tricky to tell them apart.

You can find out which device token are invalid in the production environment (which means they are probably development tokens) by sending notifications for all your device tokens. After each send you should try to read an error response from Apple. Error response 8 means invalid device token. You should use a long timeout for that read (since it sometimes takes time to get the error response from Apple).

Upvotes: 1

Related Questions