Messaging示例不起作用

Messaging示例不起作用

本文介绍了Firebase Cloud Messaging示例不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在研究有关设置Cloud Messaging的教程.我按照 https://firebase.google.com/docs/cloud-messaging/js/client?authuser=0 当我尝试发送curl命令时,出现一个奇怪的错误.我已经阅读了Cloud Messaging快速入门以及其他一些尝试解决该错误的页面,但无济于事.

I am working through the tutorial on setting up Cloud Messaging. I followed the instructions in the video on the page https://firebase.google.com/docs/cloud-messaging/js/client?authuser=0when I try to send the curl command I get a strange error. I have read the Cloud Messaging quickstart as well as a few other pages trying to solve the error, but to no avail.

我在命令行上输入的命令是:

The command I entered on the command line is:

卷曲--header 授权:键= AIzaSyCFCmFwwWV53PqV2M-NUZyp6lYSz43tUiQ" --header 内容类型:应用/JSON" -d{ 到":di6GZyDevbI:APA91bFhNMiuJaMIE3IQL2NurPCWBhCtzculj5uvx-on121Z0UczJ0FyiiQbaRFvGqNs3bmq084vQ-Z-8vF_GZQ5J-QCBrWgp4_saWSwTXytZmScNbPLGRkOQns_QgETStDTmLJwixI1,"通知:{"标题:"你好,"身体:"世界,"图标:"/firebase_logo.png}}"'https://fcm.googleapis.com/fcm/send

结果是:

curl: (3) Port number ended with 'A'
curl: (6) Could not resolve host: notification
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: title
curl: (6) Could not resolve host: Hello,
curl: (6) Could not resolve host: body
curl: (6) Could not resolve host: World,
curl: (6) Could not resolve host: icon
curl: (3) <url> malformed
curl: (3) [globbing] unmatched close brace/bracket in column 1
JSON_PARSING_ERROR: Unexpected character (') at position 0.

推荐答案

问题出在Windows命令行上的引号上.在将单引号替换为双引号并转义内部引号后,其工作原理如下:

The issue was with the quotes on the windows command line. After replacing the single quotes with double quotes and escaping the inner quotes it works, like so:

卷曲-X POST -H 授权:键= AAAAATYbVMw:APA91bFAEaRl8bZPgWGNGA7BCP22y_OLIlHevfUjEXEEklDav1sOwcxiFiFin625JsdaWJBAF06-U1Ey9-mhz6f2Es9-ztOeXpco6_AkvIbEO4dbe2LnI_JVw-W7mqOT5KeSn23y4b1h" -H 内容类型:应用/JSON" -d {\" 到\:\ di6GZyDevbI:APA91bFhNMiuJaMIE3IQL2NurPCWBhCtzculj5uvx-on121Z0UczJ0FyiiQbaRFvGqNs3bmq084vQ-Z-8vF_GZQ5J-QCBrWgp4_saWSwTXytZmScNbPLGRkOQns_QgETStDTmLJwixI1 \",\ 通知\":{\ 称号\":\ 你好\",\ 身体\":\ 世界\",\图标\:\"/firebase_logo.png \}}""https://fcm.googleapis.com/fcm/send"

产生预期的结果:

{"multicast_id":5167616001901538265,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1530306327290339%e609af1cf9fd7ecd"}]}

这篇关于Firebase Cloud Messaging示例不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 17:28