Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 and apple push notification service

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

like image 509
vdaubry Avatar asked Jan 08 '11 08:01

vdaubry


People also ask

How do I use Apple push notifications?

Go to Settings and tap Notifications. Select an app under Notification Style. Under Alerts, choose the alert style that you want. If you turn on Allow Notifications, choose when you want the notifications delivered—immediately or in the scheduled notification summary.

Are Apple push notifications guaranteed?

The system makes every attempt to deliver local and remote notifications in a timely manner, but delivery isn't guaranteed. The PushKit framework offers a more timely delivery mechanism for specific types of notifications, such as those VoIP and watchOS complications use.

What is Apple APNs used for?

Apple Push Notification service (APNs) is a cloud service that allows approved third-party apps installed on Apple devices to send push notifications from a remote server to users over a secure connection. For example, a newstand app might use APNs to send a text alert to an iPhone user about a breaking news story.

How do push notifications work on iOS?

An iOS push notification is a message that pops up on an Apple device such as an iPhone. Before receiving push notifications from an app, iOS device users must explicitly give permission. Once a user opts-in, mobile app publishers can send push notifications to the users' mobile devices.


2 Answers

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

like image 164
Yekmer Simsek Avatar answered Sep 22 '22 15:09

Yekmer Simsek


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

like image 22
ileitch Avatar answered Sep 20 '22 15:09

ileitch