mardi 28 juin 2016

Using FCM token obtained via batchImport (iOS)


I am trying to migrate an existing app to use FCM. I took the APNS token and sent it to the "batchImport" service, using curl:

curl -H "Authorization: key=<auth key>" -H "Content-Type: application/json" -X POST -d "{"application": "com.myco.myapp", "sandbox": false, "apns_tokens": ["410564ffd0aaf91dd06e8ab7b8362238e2c7f1bbd5a520d6afaff38c9b670a90"] }" https://iid.googleapis.com/iid/v1:batchImport

I receive a "registration_token" in response. When I then try to use that token to request a push notification, it does not arrive on the device. Here's the curl from that:

curl -H "Authorization: key=<Auth key>" -H "Content-Type: application/json" -d "{"to":"<registration_token_from_above>", "notification":{"body":"First", "title":"Num 1"}}" -X POST https://fcm.googleapis.com/fcm/send

I am also unable to send from the "Notification" tool in the Firebase console.

I created a second project from scratch from the example here: https://github.com/firebase/quickstart-ios.git . This one works from both the Firebase console and curl.

Is there something magical happening in the Firebase client code that doesn't happen when I use the batchImport service? If so, how in the world would you migrate from a different service to FCM?


Aucun commentaire:

Enregistrer un commentaire