【问题标题】:InvalidRegistration respond from FCM来自 FCM 的 InvalidRegistration 响应
【发布时间】:2020-04-22 08:32:38
【问题描述】:

来自documentation

检查您传递给服务器的注册令牌的格式。确保它与客户端应用通过 Firebase 通知注册收到的注册令牌相匹配。不要截断或添加其他字符。

所以我检查了 iOS 应用程序接收到的 FCM 令牌和数据库存储的令牌。他们是identical

尽管如此,我还是一遍又一遍地收到同样的错误

"result":{
     "multicast_id":8326997376324259978,
     "success":0,
     "failure":1,
     "canonical_ids":0,
     "results":[{
            "error":"InvalidRegistration"
      }
]}

有人能睁开眼睛看看错过了什么吗?

....请放心

【问题讨论】:

  • 到目前为止没有答案....您需要什么信息来阐明真相?

标签: ios push-notification firebase-cloud-messaging


【解决方案1】:

同时fcm请求准备

private function sendPushNotificationToIOS($tokens, $notification) {
     $fields = array(
        'registration_ids'  => $tokens,
        'priority'          => 'high',
        'content_available' => true,
        'mutable_content'   => true,
        'notification'      => $notification,
        'data'              => $notification,
     );
}

我将$tokens 作为 Laravel 集合发送,这就是为什么我的服务器没有收到任何错误。 所以一定要使用数组。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-17
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    相关资源
    最近更新 更多