问题
Has anybody been able to send push notification to iPhone using rails 3 ? APN on rails and samesoffes plugin only works with rails 2. I am new to rails and i have not been able to make either of them work.
Here are the errors i encountered :
APN on Rails :
tried to replace
ruby script/generate apn_migrations
With
rails generate apn_migrations
got :
myApp/config/environment.rb:5:in `require': no such file to load -- apn_on_rails (LoadError)
I also did not manage to run the configuration "config.gem 'apn_on_rails'" (config.gem: command not found)
Samsoffes plugin :
I did not manage to config the gem :
config.gem "apple_push_notification", :source => "http://gemcutter.org/"
gave me :
http://gemcutter.org/: No such file or directory
Any help would be greatly appreciated !
Thanks, Vincent
回答1:
I had the same problem, I had used a rails3 branch
gem 'apn_on_rails', :git => 'https://github.com/natescherer/apn_on_rails.git', :branch => 'rails3'
This solved my problem and I wrote the details to my blog
http://yekmer.posterous.com/how-to-send-iphone-push-notifications-in-rail
回答2:
I've written an apn_on_rails replacement called Rpush specifically targeted at Rails 3. I've also added a bunch of extra features like persistent connections to the APNs (as recommended by Apple). Frequent connects/disconnects may get you banned from the APNs, which is how apn_on_rails currently works.
Rpush: https://github.com/rpush/rpush
回答3:
In rails 3, there is no config.gem... Open up your Gemfile
:
gem 'apple_push_notification', :git => 'http://gemcutter.org/path_to_that_gem_on_gem_cutter.git'
来源:https://stackoverflow.com/questions/4633112/rails-3-and-apple-push-notification-service