Pr0Ger/PyAPNs2

DeviceTokenNotForTopic for voip push

cdg720 opened this issue · 1 comments

Hi,

token_hex = 'device token hex'
payload = Payload(alert="Hello World!", sound="default", badge=1)
topic = 'com.my.app'
client = APNsClient('aps.pem', use_sandbox=True, use_alternative_port=False)
client.send_notification(token_hex, payload, topic)

runs fine whereas

token_hex = 'device token hex'
payload = Payload(alert="Hello World!", sound="default", badge=1)
topic = 'com.my.app.voip'
client = APNsClient('aps.pem', use_sandbox=True, use_alternative_port=False)
client.send_notification(token_hex, payload, topic)

returns DeviceTokenNotForTopic:

(I tried both with the Apple Push Services certificate.)

#70 and

PyAPNs2/apns2/client.py

Lines 114 to 115 in 5e4a938

if topic.endswith('.voip'):
inferred_push_type = NotificationType.VoIP.value
seem to indicate that I should append voip to topic but it is not working for me.

Can someone help me?

I found the problem. The device token for normal APNs and one for VoIP are different.