问题
I am trying to setup a Firebase Cloud Function that will trigger a Cloud Messaging with Payload. The received load by the function however contains Apple APNS Tokens rather than FCM Tokens and I don't see any methods in Firebase Admin SDK allowing APNS Token rather than FCM.
Does that mean that I have to write my own APNS Provider and not use FCM?!
回答1:
Does that mean that I have to write my own APNS Provider and not use FCM?!
You could do that. I don't see how this is a shock. In order to use FCM, you need to use FCM tokens. It's just how a service works.
With all that said, you could also use the InstanceID Server API to create registration tokens with the APNs tokens:
Create registration tokens for APNs tokens
Using the Instance ID service's batchImport method, you can bulk import existing iOS APNs tokens to Google Cloud Messaging or Firebase Cloud Messaging, mapping them to valid registration tokens. Call the Instance ID service at this endpoint, providing a list of APNs tokens in the JSON body:
https://iid.googleapis.com/iid/v1:batchImport
The response body contains an array of Instance ID registration tokens ready to be used for sending FCM or GCM messages to the corresponding APNs device token.
来源:https://stackoverflow.com/questions/50344633/firebase-cloud-function-messaging-with-apns-token-rather-than-fcm-token