apns-php使用生产配置文件发送推送通知

时间:2012-05-09 14:58:13

标签: php ios notifications push

我们使用apns-php实现推送通知服务,并且最近遇到了这个问题:

推送通知适用于我们的开发资料,不适用于生产。

我们没有从苹果服务器获得任何错误,我们可以看到它们正常工作。这是日志

2012/05/09 07:26:50 [trace] [push_notification] APNS: INFO: Trying ssl://gateway.push.apple.com:2195...
2012/05/09 07:26:51 [trace] [push_notification] APNS: INFO: Connected to ssl://gateway.push.apple.com:2195.
2012/05/09 07:26:51 [trace] [push_notification] APNS: Added recipient iPad with YSA_ID:209
2012/05/09 07:26:51 [trace] [push_notification] APNS: Added recipient iPad with YSA_ID:323
2012/05/09 07:26:51 [trace] [push_notification] APNS: Added recipient iPad with YSA_ID:326
2012/05/09 07:26:51 [trace] [push_notification] APNS: INFO: Sending messages queue, run #1: 3 message(s) left in queue.
2012/05/09 07:26:51 [trace] [push_notification] APNS: STATUS: Sending message ID 1 [custom identifier: YSA-Notification-ID#181] (1/3): 121 bytes.
2012/05/09 07:26:51 [trace] [push_notification] APNS: STATUS: Sending message ID 2 [custom identifier: YSA-Notification-ID#181] (1/3): 121 bytes.
2012/05/09 07:26:51 [trace] [push_notification] APNS: STATUS: Sending message ID 3 [custom identifier: YSA-Notification-ID#181] (1/3): 121 bytes.
2012/05/09 07:26:52 [trace] [push_notification] APNS: INFO: Disconnected.

所以你可以看到没有错误。但iPad上没有收到任何通知。

也许以前有人遇到过这个问题?任何帮助都将受到高度赞赏。

谢谢!

2 个答案:

答案 0 :(得分:1)

在某处我读过两个SSL证书都可以放入一个PEM文件中。不幸的是,提示似乎不正确......

我发现在单个PEM文件中同时拥有生产和沙盒SSL证书会导致生产环境无声地失败。

解决方案是将PEM拆分为两个单独的文件并相应地传递给服务器:

$server=new ApnsPHP_Push_Server(ApnsPHP_Abstract::ENVIRONMENT_SANDBOX, 'server_certificates_bundle_sandbox.pem');

$server=new ApnsPHP_Push_Server(ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION, 'server_certificates_bundle_production.pem');

之后,一切正常。

答案 1 :(得分:0)

另请检查您的App ID是否已启用推送通知

相关问题