Open contacitltd opened 8 years ago
Does not work for me too. I can give more info if required, for now @contacitltd example should be enough.
In the mean time, I take it Apple will not like it if you send 30k push notifications with the send_notification()
method?
I seem to have the same problem. Here's my code:
...
frame_cl = Frame()
...
for *something*
frame_cl.add_item(token, payload, identifier, expiry, priority)
...
apns_cl = APNs(use_sandbox=False, cert_file='*dir*/****.pem')
apns_cl.gateway_server.send_notification_multiple(frame_cl)
...
I have this error:
File "/*myproject*/send.py", line 218, in send_notice
apns_cl.gateway_server.send_notification_multiple(frame_cl)
File "build/bdist.linux-x86_64/egg/apns.py", line 559, in send_notification_multiple
self._sent_notifications += frame.get_notifications(self)
AttributeError: 'GatewayConnection' object has no attribute '_sent_notifications'
It's fixed in this fork https://github.com/mnemonicflow/PyAPNs here https://github.com/mnemonicflow/PyAPNs/commit/f07515ec610475a715f6fd3e35595f875b13586d This projest seems to be abadoned
same issue here.. and above fork by @diman94 is not reachable (broken link). any one knows the actual link?
I almost shure I have it on my computer. I will upload it tomorrow if I don't forget. You may look through recent forks of this project (as I did), maybe you'll find something useful.
Try this one https://github.com/diman94/PyAPNs/
As I remember
self._sent_notifications += frame.get_notifications(self)
replaced with
if self.enhanced: self._sent_notifications += frame.get_notifications(self)
@contacitltd @skftn @connectarena Excuse me. Would you mind to tell me if you're using enhanced mode or not?
I'm using very old version of PyAPNs and legacy notification (not enhanced notification), but recently I often got stuck when sending multiple notifications. It really bothers me, so I'm trying to upgrade the lib and replace with the enhanced mode. Till now, I haven't met the same issue in sandbox testing yet, but according to my experience, it's not easy to reproduce, so I need more details about your questions to infer if the stuck problem still remains, if so, maybe I should think a plan B.
I thought it worked at some point in the past, but my problem is only involving banner type notifications when the application is not in the foreground.
Given what @djeer said about what fix was made in that fork, and that self._sent_notifications = collections.deque(maxlen=SENT_BUFFER_QTY)
has now been moved out of the if enhanced
block of the init for APNs in the source repo, I think this was a bug that probably doesn't exist anymore and this issue should be closed.
I have been using the send_notification_multiple function for quite some time, but it has stopped working yesterday.. When I add more than one notification to the frame, the messagses are not delivered to the devices (when there is only one notification in the frame, it does work). As I used this for a long time before it recently stopped working, i can only suspect Apple has changed something in the API?
For reference, here is my code:
Has anyone experienced a similar issue?