jpoz / APNS

An Apple Push Notification Service gem
MIT License
543 stars 195 forks source link

Duplicated pushes #19

Open ghost opened 11 years ago

ghost commented 11 years ago

Hello, I'm using your gem for one of my project. The project allows the user to send a push notification of an event, a user can have multiple events. When I use this code to send the push:

push_notification.devices.each do |d|
         APNS.send_notification(d.token, :alert => push_notification.event.title, :badge => 0, :sound => 'default', :other => {:event_id => push_notification.event.id})  
      end

everything works fine.

if insteas I use this code

 pushes = [] 
      push_notification.devices.each do |d|
         pushes << APNS::Notification.new(d.token, :alert => push_notification.event.title, :badge => 0, :sound => 'default', :other => {:event_id => push_notification.event.id})  
      end
       APNS.send_notifications(pushes)

I receive, on the phone side, pushes for events I pushed even yesterday (actually for all the events that have been pushed). I'm not saying this is a bug of your gem, maybe it's about the way the apple manages the push requests, just to let you know.

toto commented 11 years ago

It is a bug I the gem. More precisely in my update to it. Please use either an older version or my fork (https://github.com/toto/APNS) until it is fixed.

arthurchui commented 6 years ago

@jpoz I experienced the same issue as well. Looks like https://github.com/jpoz/APNS/compare/master...toto:master had the proper fix. Do you plan to merge it?