How to send apn-topic on registration using APN

  • 1
  • Problem
  • Updated 4 years ago
Expected Behaviour

Send push notification to registered device token with this plugin for iOS (Android has no problem)

Actual Behaviour

I am always receiving {“reason”:”DeviceTokenNotForTopic”}

Reproduce Scenario (including but not limited to)

Everything seems to be OK in the client app. I ask me for permission to receive push notifications.

But when I try to send a push notification through APNs service from the server using the registered token over http, I am always receiving {"reason":"DeviceTokenNotForTopic"}

Steps to Reproduce

In iOS, I am trying to send push notification from commad line with this order:

curl -d '{"aps":{"alert":"[MESSAGE]","sound":"default"}}' --cert "[PATH TO APS CERTIFICATE.pem]":"" -H "apns-topic: [BUNDLE IDENTIFIER]" --http2 https://api.development.push.apple.co...

But I am always receiving this error:

{"reason":"DeviceTokenNotForTopic"}

In my config.xml I've used this bundle id

Sample Push Data Payload

'{"aps":{"alert":"Hi","sound":"default"}}'

Sample Code that illustrates the problem

curl -d '{"aps":{"alert":"Hi","sound":"default"}}' --cert "mycert.pem":"" -H "apns-topic: es.mypush.example" --http2 https://api.push.apple.com/3/device/b...

Logs taken while reproducing problem

{"reason":"DeviceTokenNotForTopic"}
Photo of Víctor Téllez

Víctor Téllez

  • 11 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1

Be the first to post a reply!