【发布时间】:2015-11-12 07:26:35
【问题描述】:
registration_id 被列入黑名单时,我收到了奇怪的 GCM 响应 有效载荷是
{"data":{"title":"Your troopers were attacked"},"registration_ids":["BLACKLISTED"]}
回复是
{"multicast_id":9151224166188989772,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidParameters"}]}
响应头是
[headers] => Array
(
[content-type] => application/json; charset=UTF-8
[date] => Thu, 12 Nov 2015 04:16:06 GMT
[expires] => Thu, 12 Nov 2015 04:16:06 GMT
[cache-control] => private, max-age=0
[x-content-type-options] => nosniff
[x-frame-options] => SAMEORIGIN
[x-xss-protection] => 1; mode=block
[server] => GSE
[alternate-protocol] => 443:quic,p=1
[alt-svc] => quic=":443"; p="1"; ma=604800
[accept-ranges] => none
[vary] => Accept-Encoding
[transfer-encoding] => chunked
)
[http_version] => HTTP/1.1
[status] => 200
[message] => OK
我在文档 https://developers.google.com/cloud-messaging/http-server-ref#table9 中找不到此类错误。有谁知道这个错误是什么意思?
对于任何其他registration_id,例如“GOOGLE”,我得到了正确的响应InvalidRegistration
【问题讨论】:
-
哪个客户端应用发出了设备端注册请求?您是否使用模拟器进行注册?
-
没关系 :) 我知道这不是有效的 GCM 令牌(例如来自模拟器),我也没有任何模式可以在服务器端验证令牌(stackoverflow.com/questions/33355586/…)。但我不知道如何在服务器端处理此类错误 InvalidParameters,例如 - 是否需要从数据库中删除此类设备。谢谢!
-
实际上,如果我们知道特定的模拟器导致注册错误,这有助于排除故障。