【问题标题】:Rails 3 and apple push notification serviceRails 3 和苹果推送通知服务
【发布时间】:2011-01-08 08:34:52
【问题描述】:

是否有人能够使用 rails 3 向 iPhone 发送推送通知? APN on railssamesoffes plugin 仅适用于 rails 2。我是 rails 新手,我无法让它们中的任何一个工作。

这是我遇到的错误:

Rails 上的 APN:

试图替换

ruby script/generate apn_migrations

rails generate apn_migrations

得到:

myApp/config/environment.rb:5:in `require': 没有要加载的文件 -- apn_on_rails (加载错误)

我也没有设法运行配置“config.gem 'apn_on_rails'”(config.gem:找不到命令)

Samsoffes 插件:

我没有设法配置 gem:

config.gem "apple_push_notification", :source => "http://gemcutter.org/"

给了我:

http://gemcutter.org/: 没有这样的文件或 目录

任何帮助将不胜感激!

谢谢, 文森特

【问题讨论】:

  • 对不起文森特。我已经很多年没有研究过那个宝石了。此处推荐的其他产品看起来是不错的选择。

标签: ruby-on-rails-3 apple-push-notifications


【解决方案1】:

我也遇到了同样的问题,我用的是 rails3 分支

gem 'apn_on_rails', :git => 'https://github.com/natescherer/apn_on_rails.git', :branch => 'rails3'

这解决了我的问题,我将详细信息写到我的博客

http://yekmer.posterous.com/how-to-send-iphone-push-notifications-in-rail

【讨论】:

  • 很棒的教程!但我收到错误 uninitialized constant APN::Device 。我在我的环境中添加了 require 'apn_on_rails'。rb 你知道可能是什么问题吗?
  • 好像不能正确加载APN库,不知道为什么加载不出来
  • 很遗憾,您的博客不再在线。您是否也在其他地方发布了您的解决方案?
  • Posterous 已经关闭,我将移动我的博客,但我建议您寻找其他解决方案,这是一个相当老的帖子,我相信有很多新的库。
【解决方案2】:

我编写了一个名为 Rpush 的 apn_on_rails 替代品,专门针对 Rails 3。我还添加了许多额外的功能,例如与 APN 的持久连接(Apple 推荐)。频繁的连接/断开连接可能会使您被 APNs 禁止,这就是 apn_on_rails 当前的工作方式。

转发:https://github.com/rpush/rpush

【讨论】:

【解决方案3】:

在 rails 3 中,没有 config.gem... 打开你的 Gemfile:

gem 'apple_push_notification', :git => 'http://gemcutter.org/path_to_that_gem_on_gem_cutter.git'

【讨论】:

  • 感谢您的回答,我在使用“bundle install”时仍然收到错误消息:bundle install Fetching rubygems.org/gems/apple_push_notification fatal: rubygems.org/gems/apple_push_notification/info/refs not found: 你在 git update-server-info 上运行了吗服务器? git 在运行git clone "http://rubygems.org/gems/apple_push_notification" "/Library/Ruby/Gems/1.8/cache/bundler/git/apple_push_notification-fc1fb9f2476b5302441ccfbe6e128df192ffe790" --bare --no-hardlinks 时出现错误。无法完成捆绑。
猜你喜欢
  • 2010-12-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-08
  • 2011-12-03
  • 2012-10-20
  • 2017-10-25
相关资源
最近更新 更多