简体   繁体   English

无法使用Rails,apn_sender gem连接到APNS(Apple Push Notifications服务器)

[英]could not connect to APNS(Apple Push Notifications Server) using Rails, apn_sender gem

I am using Rails 3.2.2 and apn_sender 1.0.5 gem . 我正在使用Rails 3.2.2apn_sender 1.0.5 gem I have generated proper apn_development.pem and apn_production.pem . 我已经生成了正确的apn_development.pemapn_production.pem I have added them in my rails application. 我已经在我的rails应用程序中添加了它们。 By looking at some article, i have modified the apn_production.pem files permissions also. 通过查看一些文章,我还修改了apn_production.pem文件权限。 still i am not able to connect to Apple's APNS Server from my Rails Application. 仍然无法从Rails应用程序连接到Apple的APNS服务器。

feedback_data = APN::Feedback.new(:environment => :production), still returns
#<APN::Feedback: Connection not currently established to feedback.push.apple.com on 2196> 

Am i missing something or does any body have a detailed tutorial of how to send (APNS) Apple push notifications from a Rails Application. 我是否缺少任何东西,或者没有任何人有关于如何从Rails应用程序发送(APNS)Apple推送通知的详细教程。
Any help would be greatly appreciated. 任何帮助将不胜感激。

I have found solution. 我找到了解决方案。 After generating proper certificates, i was having issue with "development build of the application for other environments". 生成正确的证书后,我遇到了“针对其他环境开发应用程序”的问题。 By replacing the mobile application with appropriate build, problem was solved. 通过用适当的构建替换移动应用程序,解决了问题。

Thanks! 谢谢!

the APN::Feedback.new() returns # which is a bit misleading. APN :: Feedback.new()返回#,这有点误导。 I thought there was a connection elsewhere that I had to make. 我以为必须在其他地方建立联系。

Turns out, I just had to call the .data method to start the connection 原来,我只需要调用.data方法即可开始连接

feedback_data = APN::Feedback.new().data

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM