推送通知在生产环境中不起作用
当我在开发模式下运行我的应用程序时,我可以毫无问题地获取通过 PushMeBaby 发送给自己的推送通知。但是,当我尝试在生产环境中测试它时,我无法收到任何推送通知。我重新生成了所有证书和配置文件,使用 aps_product_identity.cer 作为推送通知的证书,将 SSL 更改为 gateway.push.apple.com,并为应用程序进行了发布构建,但仍然无法获得让它工作。我发现在 PushMeBaby 中,该行
result = SSLHandshake(context);
返回错误 -9844。这是否意味着 aps_product_identity.cer 文件有问题?
When I run my app in development mode, I can get the push notifications I send to myself through PushMeBaby without a problem. However, when I try to test it in the production environment, I can not get any push notifications. I re-generated all the certificates and provisioning profiles, used the aps_production_identity.cer as the certificate for push notifications, changed the SSL to gateway.push.apple.com, and did a release build for the app, but still couldn't get it to work. I found that in PushMeBaby, the line
result = SSLHandshake(context);
Returns error -9844. Does this mean that something is wrong with the aps_production_identity.cer file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,我已经解决了这个错误。我花了几天时间寻找解决方案。问题出在这一行:
您必须将端口更改为数字 30。这可以解决问题。
Yes, I've solved this error. I lost a few days finding the solution. The problem is in the line:
You have to change the port to number 30. This solves the problem.
我认为最好不要在代码中硬编码这样的数字,即使它是示例代码。我认为 30 是一个端口号(对我没有进行更多代码评估感到羞耻)。
我将该行更改为如下所示:
I think it is better to not hardcode numbers like this in code, even if it is sample code. I thought that the 30 was a port number (shame on me for not doing more code evaluation).
I changed that line to something like this: