APNS
APNS copied to clipboard
Duplicated pushes
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.
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.
@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?