我们使用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上没有收到通知。
也许以前有人遇到过这个问题?任何帮助将不胜感激。
谢谢!
我在某处读到两个SSL证书都可以放入一个PEM文件中。不幸的是,这个提示似乎不正确...
我发现将生产和沙盒 SSL 证书同时放在一个 PEM 文件中会导致生产环境以静默方式失败。
解决方案是将 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');
在那之后,一切正常。
也请检查您的应用 ID 是否启用了推送通知