Skip to content

[ERROR] NoMethodError, undefined method `to_binary' for Rapns::Notification #189

maricris-sn opened this Issue Dec 17, 2013 · 4 comments

2 participants



I need some advice how to troubleshoot this. I have followed the necessary instructions. Certificates are in place, app, devices and notifications are okay. When I run

bundle exec rapns development -f

I get this:

[2013-12-17 14:18:05] [myapp] Started, 1 handler.
[2013-12-17 14:18:08] [myapp] Connected to
[2013-12-17 14:18:08] [ERROR] NoMethodError, undefined method
to_binary' for #Rapns::Notification:0x007fbf10418418
/Users/chris/Work/myapp/vendor/ruby/1.9.1/gems/activemodel-3.1.12/lib/active_model/attribute_methods.rb:385:in method_missing'
/Users/chris/Work/myapp/vendor/ruby/1.9.1/bundler/gems/rapns-bc59e42f0621/lib/rapns/daemon/apns/delivery.rb:28:in perform'
/Users/chris/Work/myapp/vendor/ruby/1.9.1/bundler/gems/rapns-bc59e42f0621/lib/rapns/daemon/delivery_handler.rb:42:in handle_next_notification'
block (2 levels) in start'
/Users/chris/Work/myapp/vendor/ruby/1.9.1/bundler/gems/rapns-bc59e42f0621/lib/rapns/daemon/delivery_handler.rb:12:in loop'
block in start'
[2013-12-17 14:18:08] [myapp] Connected to

I'm on:

Rails 3.1.12
Ruby 1.9.3-p125
Rapns 3.5.0

Any help would be appreciated. Thank you!

ileitch commented Dec 17, 2013

How did you create the notification? It looks like you may have used Rapns::Notification instead of Rapns::Apns::Notification.


Thanks for the reply. Here's what I did:

    selected_devices.each do |device|
      n = = Rapns::Apns::App.first
      n.device_token = device
      n.alert = notification.alert
      n.sound = 'default'
      n.shop_id = id!
    end unless selected_devices.blank?

What should I look out for?

ileitch commented Jan 3, 2014

do a SELECT DISTINCT type FROM rapns_notifications, what do you get?


As I was fixing an app with an old rapns version, I revamped the code a bit. I removed old references and created new tables. This solved my problem. Also, I found that using the gem instead of referencing the git repo was helpful.

Thanks for the assistance!

@maricris-sn maricris-sn closed this Jan 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.