收不到推送通知消息
我已经成功创建了 APNS 开发认证,使用 mobileprovision 证书签署了代码,还生成了 .p12 和 .pem 证书。我已经成功获得了设备令牌,并且在我的 iPhone 上安装了应用程序。
我尝试过测试脚本 PHP(https://devforums.apple.com/message/50461 )和 Python (Apple PNS (推送通知服务)示例代码)并且两者都运行良好,没有任何错误消息,但我的 iPhone 上没有收到推送通知警报。最初我有这个但它已解决。我知道 APNS 消息不受保证,但它们有可能完全丢失吗?我尝试发送多条消息,但没有一条出现。
谁能帮我理解可能出了什么问题吗?
谢谢。
I have created APNS development certification successfully, signed the code with mobileprovision certificate, and also generated .p12 and .pem certificates.I have successfully got the device token and also have application installed on my iPhone.
I have tried testing script PHP(https://devforums.apple.com/message/50461) and Python (Apple PNS (push notification services) sample code) and both are running fine without any error messages but I am not getting Push Notification Alert on my iPhone. Initially I had this but it is resolved. I know that APNS messages are not guaranted but is it possible they get lost totally? I tried sending multiple messages but non of them appeared.
Could anyone please help me to understand what could be going wrong?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一种可能性是,确保您使用正确的环境、用于开发中的应用程序的沙箱以及用于从应用程序商店下载的应用程序的生产环境。
您还可以注册 Urban Airship 的免费帐户以帮助排除故障。他们有一个用于发送推送通知的测试控制面板。
One possibility, be sure you are using the correct environment, sandbox for apps in development, and production for those downloaded from the app store.
You could also sign up for a free account with Urban Airship to help troubleshoot. They have a test control panel for sending push notifications.
解决方案:
替换以下行
$msg = chr(0) 。字符(0) 。字符(32) 。 base64_decode($token64) 。字符(0) 。 chr(strlen($payload)) 。 $有效负载;
与
$msg = chr(0) 。字符(0) 。字符(32) 。包('H*', $token64) 。字符(0) 。 chr(strlen($payload)) 。 $有效负载;
工作..!!基于 this 形式方法 - base64_decode 附加了额外的字符,因此它不起作用。
Resolution:
Replacing following line
$msg = chr(0) . chr(0) . chr(32) . base64_decode($token64) . chr(0) . chr(strlen($payload)) . $payload;
with
$msg = chr(0) . chr(0) . chr(32) . pack('H*', $token64) . chr(0) . chr(strlen($payload)) . $payload;
worked..!! Based on this formar method - base64_decode appends extra characters and hence, it didn't work.
请检查此问题的答案
我也遇到了同样的 问题问题。如果您的 .pem 文件正确,那么使用以下设置您将收到推送通知。 (检查终端命令以使.pem)
有关更多详细信息,请检查此 link1 >> link2 >>> ;
Please check answers of this question
I faced this same problem. If your .pem file is correct then using following setting you will get push notification. (check terminal commands to make .pem)
for more detail check this link1 >> link2 >>