Closed CTassisF closed 8 years ago
@CTassisF May I know what's the reproducing step of this issue?
This is how I am sending Push Notifications:
import pyapns # I renamed apns.py to pyapns.py
connection = pyapns.APNs(use_sandbox = True, cert_file = StringIO.StringIO(sandbox_cert), key_file = StringIO.StringIO(key))
alert = (self.request.get('alert') if self.request.get('alert') else None)
sound = (self.request.get('sound') if self.request.get('sound') else None)
badge = (long(self.request.get('badge')) if self.request.get('badge') else None)
custom = {'foobar': (long(self.request.get('foobar')) if self.request.get('foobar') else None)}
content_available = (True if sound else False)
payload = pyapns.Payload(alert = alert, sound = sound, badge = badge, custom = custom, content_available = content_available)
frame = pyapns.Frame()
identifier = (long(self.request.get('line')) if self.request.get('line') else 0)
expiry = time.time() + 3600
priority = 10
apnslist = json.loads(self.request.get('json')) # apnslist is an array of APNs tokens
for apns in apnslist:
frame.add_item(apns, payload, identifier, expiry, priority)
connection.gateway_server.send_notification_multiple(frame)
If you want to use enhance mode, please refer to document and specify enhanced=True
,
apns_enhanced = APNs(use_sandbox=True, cert_file='apns.pem', enhanced=True)
however, for non-enhance mode, it should not use re-send mechanism that cause this error, please @xilvar to check it.
Hm. Strange. I'll take a look at it later tonight. @ctassisf
Sent from my iPhone
On Jan 14, 2015, at 6:56 PM, Jim Horng notifications@github.com wrote:
If you want to use enhance mode, please refer to document and specify enhanced=True,
apns_enhanced = APNs(use_sandbox=True, cert_file='apns.pem', enhanced=True) however, for non-enhance mode, it should not use re-send mechanism that cause this error, please @xilvar to check it.
— Reply to this email directly or view it on GitHub.
Please update README if enhaced=True is needed for send_notification_multiple. It wasn't required prior 2.0.1.
It shouldn't be required, should be a bug 2015/4/10 上午9:28於 "Nam Ngo" notifications@github.com寫道:
Please updater README if enhaced=True is needed for send_notification_multiple. It wasn't required prior 2.0.1.
— Reply to this email directly or view it on GitHub https://github.com/djacobs/PyAPNs/issues/108#issuecomment-91395719.
Ran into this one too.
Ran into this one too, running the sample usage script. Adding enchanced=True to the APNs() fixed it, like so:
apns = APNs(use_sandbox=True, cert_file='my_cert.pem', key_file='my_key.pem', enhanced=True)
Is this expected behaviour?
Hm. Is it still doing that? I thought someone else's PR had fixed that bug quite a while back. That being said you probably want to use enhanced apns anyway since old(er) apns is simply worse... I'll take a look at the codebase and see if it ended up with the bug again when I have a chance.
On Tue, Jun 28, 2016 at 2:03 AM, Boris Stoyanov notifications@github.com wrote:
Ran into this one too, running the sample usage script. Adding enchanced=True to the APNs() fixed it, like so: apns = APNs(use_sandbox=True, cert_file='my_cert.pem', key_file='my_key.pem', enhanced=True)
Is this expected behaviour?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/djacobs/PyAPNs/issues/108#issuecomment-228993075, or mute the thread https://github.com/notifications/unsubscribe/AARJIW9nz1ucb-2y1DKytb2nltk7mBMDks5qQONTgaJpZM4DSnxh .
Still doing that.
Adding enhanced=True
to the APNs() still fixes it.
Adding enhanced=True
results in duplicate notifications, still have this bug withou enhanced
PyAPNs v2.0.1:
AttributeError: 'GatewayConnection' object has no attribute '_sent_notifications'