从沙箱切换后,推送通知在生产环境中不起作用 [英] Push Notification not working in production environment after switched from sandbox

查看:23
本文介绍了从沙箱切换后,推送通知在生产环境中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我现在很困惑,不知道下一步该怎么做.在过去的两周里,我一直在让这些推送通知正常工作,当我终于把它弄得干净利落时,我把它放到一个临时分发包中,并将服务器配置切换到生产环境,突然间没有任何工作,我没有要关闭的错误消息.它应该工作,它应该工作,但它没有.所以我需要一些帮助,因为我迷路了.

可能的问题 -

主机配置

首先真正帮助我让它工作的是本教程

我需要导出两个项目

接着是 .pem 转换.

成功!!

我还应该注意到问题中到 gateway.push.apple.com 的 ssl 连接的图片不是正确的连接,这里使用新的 .pem 密钥是由套接字不会关闭"的答案产生的"立即地.你应该可以在它关闭之前在那里输入一些东西.

Hi so I'm very confused at the moment and don't know what to do next. I've spent the last two weeks getting these push notifications to work correctly, and when I finally have it all neat and tidy, I put it into an adhoc distribution bundle and switch the server configurations to the production environment, suddenly nothing works and I have no error messages to go off of. It should work, it should work and it doesn't. So I need some help because I'm lost.

possible problems -

HOST CONFIG

What really helped me get it working in the first place was this tutorial here, the hosting server is Heroku and the application is written in Sinatra using this gem, and if that doesn't carry over to production environment in someway I am not seeing please tell me. To update the environment to production, I just changed which key was used and the host from gateway.sandbox.push.apple.com to gateway.push.apple.com as shown here:

APNS KEYS

I don't think it's this, but I don't understand what is going on so I documented it, but the distribution key works I believe - running

openssl s_client -connect gateway.push.apple.com:2195 -cert dis_apskey.pem 

in the terminal got this connection and transaction with the push server:

Which I believe means it worked though I don't know for sure (see edit in answer, this does NOT mean it worked). The keys were made with this command:

openssl pkcs12 -in aps_distribution.p12 -out dis_apskey.pem -nodes

from the private keys of the APS Development and Distribution certificates downloaded from the iOS development portal or whatever it is called now, exported as .p12 encrypted files:

Though, while from different private keys they did turn out strangely similar (all characters are the same)-

Is that normal? because I made both the push service certificates from the same CSR, I dunno I'm totally lost... just throwing it out there, because none of this makes sense anymore.

CODE SIGNING

I believe this is correct (from my xcode project):

Those correspond to the certificates and mobile provisioning profiles in my iOS Developer Portal and I have regenerated so many new ones, refreshed them in xcode, double checked and reloaded them in to this thing that I'd find it hard to believe this is the area of issue. But just to make sure I'm posting it, those are current profiles, made after the APS Certificates were issued. Again, this doesn't make a whole lot of sense to me and yes, I've read the documentation and it's still greek.

MOBILE DEVICE TOKENS

This again, I don't see being the issue. My app generated one token using the development profile and the sandbox was able to push notifications to it and it worked BEAUTIFULLY! Then my app generated a NEW token when I switched to the adhoc profile and build BUT with the production environment nothing gets through to it. I'll say again, everything was working correctly on the sandbox but does not now.

Any other reasons?

That's all I can think of, if anyone has something else please let me know. I just want this working and I can't see the errors if apple sends them back to failed pushes so I have no clue. It was working in the developer sandbox and should be working now, that's all I can think of.

Thanks.

解决方案

So after a long problematic bought of frustration spanning two days. What worked. Reading

I needed to export both items

followed by the .pem conversion.

and success!!

Edit: I should also note that the picture of the ssl connection to gateway.push.apple.com in the question was NOT a correct connection, using the new .pem key here produced by the answer the socket does not "close" immediately. You should be able to type something there before it's closed.

这篇关于从沙箱切换后,推送通知在生产环境中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆