iPhone push-notification works in sandbox but not in production mode

六眼飞鱼酱① 提交于 2019-12-01 05:44:58

Here is three cases you can check at your end:-

  1. Make sure that you have used the right production certificate on your server side. since we need to create two different certificates for production and sandbox. make sure you are using correct certificate on server.

  2. second you can check that you have use the right gateway and port number on server side. Since gateway for production and sandbox are different one. Gateway used for production is:- gateway.push.apple.com. and also you are using correct password on server for your certificate your have used on your server.

  3. third you can check if the notification on your device is enabled or not. You need to enable it on your iPhone as well. Make sure that is on your device.

Let me know if it works for you.

For me, i struggle this for days. Using correct production certificate and key, and also correct gateway to send the message to my developing iPhone, it sent successfully in sandbox mode, but failed with production mode. It's because there are also two kinds of device token, the testing iPhone device token is sandbox token, can not be used in the production mode. It's better to use another device's token to test the production APNs.

The detailed explanation is here

The most common problem is an invalid device token. If the token came from the sandbox environment, such as when you are testing a development build in house, you cannot send it to the production push service. Each push environment will issue a different token for the same device or computer. If you do send a device token to the wrong environment, the push service will see that as an invalid token and discard the notification.

Frans

See answer in https://stackoverflow.com/a/11623162/496222

In short: make sure both SSL certificates are in a separate PEM file. Having a single PEM file with both sandbox and production certificate will cause either environment to fail.

please also check whether your App Id enabled push notification

This solved my issue, ensure setting correct value for kGGLInstanceIDAPNSServerTypeSandboxOption. For Development mode set to YES and For production mode 'NO'.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!