小编san*_*osh的帖子

从Ruby On Rails发送IOS推送通知

我需要向IOS mobile发送推送通知.

我使用apn_on_rails发送此通知.

我从IOS开发者处获取了我的pem文件.我做了以下配置

在config/configtran/*.rb中的Productions和开发中

RAILS_ROOT, APN::App::RAILS_ENV='production'
configatron.apn.passphrase  = 'leo_123'
configatron.apn.port  = 2195
configatron.apn.host  = 'gateway.sandbox.push.apple.com'
configatron.apn.cert = File.join(Rails.root, 'config', ' apple_push_notification_development.pem')
Run Code Online (Sandbox Code Playgroud)

然后我按照文档创建了一个Notificationby.

在我运行以下命令后,它是理想的并且响应

从控制台

APN :: App.send_notifications

使用rake RAILS_ENV = production rake apn:notifications:deliver

我在生产和开发环境中都尝试过这种方法.在下面的行之后,它没有响应.我也没有在Log中找到任何东西.

APN::App Load (0.1ms)  SELECT "apn_apps".* FROM "apn_apps"
Run Code Online (Sandbox Code Playgroud)

我没有在任何云服务器上托管此应用程序.此应用程序是否应该在任何云服务器中托管以正确使用应用程序?

任何帮助赞赏.

ruby ruby-on-rails push-notification apple-push-notifications ios

4
推荐指数
1
解决办法
5635
查看次数