I am new for Firebase as well as for iOS. I am trying to send push notification using FCM.
I registered an iOS app on FCM. Both .p12
certificates added. Code developed according to FCM.
While sending notification through the Firebase Console, I'm getting the error Invalid registration token. Check the token format.
. I don't what mistake I did.
To solve the this issue
I followed complete tutorial of FCM provided for iOS. But while testing or implementing I used APN Server. While using APN Server you need only .pem file
For reference this is my .py
file code
import random
from apns import APNs, Frame, Payload
sound = "default"
badge = None
alert = "Message"
identifier = random.getrandbits(32)
apns_enhanced = APNs(use_sandbox=True, cert_file='vendor.pem', enhanced=True)
payload = Payload(alert=alert, sound=sound, badge = badge)
apns_enhanced.gateway_server.send_notification(token_hex_office, payload, identifier=identifier)
apns_enhanced.gateway_server.force_close()
Thanks