APNS推送通知不适用于生产证书 [英] apns push notifications is not working with production certificate

查看:64
本文介绍了APNS推送通知不适用于生产证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的App ID启用了推送通知,并在开发中进行了很好的检查,但是在生产环境中我没有收到通知.

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. 使用了生产SSL证书密钥
  2. 在以上博客中将沙箱更改为false

我交叉检查了我的发行设置配置文件,其中包含关键的aps环境和生产模式

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?

我已经从iTunes门户下载了我的应用程序,但是在存档时我确实将.p12文件保留在了项目中,是否有必要?

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

推荐答案

设备令牌在开发和生产环境中是不同的.生产设备令牌在开发环境中无效,反之亦然.您应该为生产令牌和开发令牌维护不同的数据库.现在,您将它们混合在一起了,要区分它们有点棘手.

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.

您可以通过发送所有设备令牌的通知来找出哪些设备令牌在生产环境中无效(这意味着它们可能是开发令牌).每次发送后,您应该尝试读取Apple的错误响应.错误响应8表示无效的设备令牌.对于该读取,您应该使用较长的超时时间(因为从Apple获得错误响应有时会花费一些时间.)

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).

这篇关于APNS推送通知不适用于生产证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆