duanjing9739 2012-05-09 14:58
浏览 138
已采纳

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

We use apns-php to implement push notification service and have faced this problem recently:

Push notifications work with our Development Profile and not work for Production.

We get no errors from apple servers and we can see that they work fine. Here's the log

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.

So as you can see there are no errors. But no notifications received on the iPad.

Maybe somebody faced this problem before? Any help would be highly appreciated.

Thanks!

  • 写回答

2条回答 默认 最新

  • duansang8388 2012-07-24 02:13
    关注

    Somewhere I've read that both the SSL certificates could be put into a single PEM file. Unfortunately that hint didn't seem to be correct...

    I found that having both the production and the sandbox SSL certificate in a single PEM file causes the production environment to silently fail.

    Solution is to split the PEM into two separate files and pass it to the server accordingly:

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

    or

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

    After that, everything worked fine.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化