IOS: Invalid registration token. Check marker format

I am new to Firebase as well as iOS. I am trying to send a push notification using FCM.

I registered an iOS app on FCM. Both certificates added .p12. Codex is developed in accordance with FCM.

When I send a notification through the Firebase console, I get an error Invalid registration token. Check the token format.. I don’t know what mistake I made.

FCM Console

+6
source share
2 answers

To solve this problem

FCM iOS. APN Server. APN Server .pem

.py

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()

-2

, iOS

  • , iOS, didRegisterForRemoteNotificationsWithDeviceToken

  • , Firebase FIRInstanceID.instanceID().token() ( AppDelegate)

, , , firebase , 2, , 1.

+10

Source: https://habr.com/ru/post/1664987/


All Articles