iOS:注册 token 无效。检查 token 格式

标签 ios firebase firebase-cloud-messaging firebase-notifications

我是 Firebase 和 iOS 的新手。我正在尝试使用 FCM 发送推送通知。

我在 FCM 上注册了一个 iOS 应用。添加了两个 .p12 证书。按照FCM开发代码。

同时通过 Firebase Console 发送通知, 我收到错误 注册 token 无效。检查 token 格式。。我不知道我做错了什么。

FCM Console

最佳答案

在 iOS 端有两个 token

  1. iOS 生成的 token 在方法 didRegisterForRemoteNotificationsWithDeviceToken

  2. 中接收
  3. Firebase FIRInstanceID.instanceID().token() 生成的 token (您可以在 AppDelegate 中打印)

您面临的问题是因为 firebase 控制台门户需要通过方式 2 接收到的 token ,而您正在使用通过方式 1 接收到的 token 。

关于iOS:注册 token 无效。检查 token 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41343520/

相关文章:

ios - 为什么 UITextfield.text 从数组中检索时返回精确的 float ?

ios - "Preloading"Swift 中带键的字典

ios - Objective-C iPhone - 立即在 Safari 中打开 URL 并退出应用程序

javascript - Firebase 函数 - admin.messaging().sendToTopic 执行但从未到达 `then` block

javascript - firebase.消息 : Cannot read property 'getNotificationPermission_' of undefined

iphone - 如何释放单例?

javascript - 无法写入 firebase 实时数据库

android - 通过添加此行 : apply plugin: 'com.google.gms.google-services' 来 react native 应用程序崩溃

push-notification - Electron APP的FCM/GCM

ios - 推送通知已发送但 didReceiveRemoteNotification 从未被称为 Swift