我在 IOS 设备上遇到推送通知的 APNS php 代码问题,我有两个独立的开发和生产连接。
- 我已经通过添加 .pem 文件证书和 Passphares 来配置我的服务器上的开发连接,它的工作完美,我也收到了通知。看看我的开发配置:
网址:'ssl://gateway.sandbox.push.apple.com:2195'
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
'APNS_Dev_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);
// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('1234567');
$push->setRootCertificationAuthority('APNS_Dev_ISAS.pem');
$push->connect();
问题:
- 比我通过添加以下参数配置生产连接但我收到连接错误:
网址:ssl://gateway.push.apple.com:2195
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,
'APNS_PROD_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);
// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('12345678');
$push->setRootCertificationAuthority('APNS_PROD_ISAS.pem');
$push->connect();
连接错误: 信息:尝试 ssl://gateway.push.apple.com:2195...错误:无法连接到“ssl://gateway.push.apple.com:2195”:(0)信息:重试连接(1/3)...信息:尝试 ssl://gateway.push.apple.com:2195...错误:无法连接到 'ssl://gateway.push.apple.com:2195 ':(0)信息:重试连接(2/3)...信息:正在尝试 ssl://gateway.push.apple.com:2195...错误:无法连接到 'ssl://gateway。 push.apple.com:2195': (0) INFO: Retry to connect (3/3)... INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0)
我用谷歌搜索了这个问题,我找到了一些解决方案,我检查了一切,一切都很好,但没有成功。
- 我使用了正确的开发和生产路径。
- 我为两者创建了单独的证书 .pem 文件,并在推送应用程序上测试了证书。证书正确。
- 端口也很好,并且没有从我的服务器阻塞,因为在开发 url 中使用了相同的端口,并且开发服务器推送通知工作正常。
任何帮助将不胜感激。提前致谢。