gpt4 book ai didi

ios - Monaca 推送通知后端管理 API 不工作

转载 作者:行者123 更新时间:2023-11-29 12:47:09 25 4
gpt4 key购买 nike

我正在尝试 Monaca 推送通知 API 教程 ( http://monaca.mobi/en/blog/archives/265 ) 从我的命令提示符使用 curl 将推送通知发送到我的 iPhone。

如果我使用这个:

curl --insecure https://cloud.monaca.mobi/manage/json-rpc/##### --data '{"jsonrpc": "2.0", "id": 1, "method": "Push.send", "params": { "pushProjectId": "#####", "platform": "ios", "target": "debugger", "buildType": "debug", "message": "manage sample" , "json" : "{ \"url\" : \"http://www.google.co.jp\" }", "deviceIdList": ["#####"] } }' --header 'X-Monaca-Backend-Management-API-Key: #####'  

我收到这些错误:

curl: (6) Could not resolve host: id
curl: (6) Could not resolve host: 1,
curl: (6) Could not resolve host: method
curl: (6) Could not resolve host: Push.send,
curl: (6) Could not resolve host: params
curl: (3) [globbing] unmatched brace in colum
curl: (6) Could not resolve host: pushProject
curl: (6) Could not resolve host: ###
curl: (6) Could not resolve host: platform
curl: (6) Could not resolve host: ios,
curl: (6) Could not resolve host: target
curl: (6) Could not resolve host: debugger,
curl: (6) Could not resolve host: buildType
curl: (6) Could not resolve host: debug,
curl: (6) Could not resolve host: message
curl: (6) Could not resolve host: manage samp
curl: (6) Could not resolve host: ,
curl: (6) Could not resolve host: json
curl: (7) Failed connect to :80; No error

然后我尝试将数据保存到senddata.json 文件

{
"jsonrpc": "2.0",
"method": "Push.send",
"params": {
"pushProjectId": "#####",
"platform": "ios",
"target": "debugger",
"buildType": "debug",
"message": "manage sample" ,
"json" : "{ \"url\" : \"http://www.google.co.jp\" }",
"deviceIdList": [ "#####" ]
},
"id": 1
}

并使用此命令调用:

curl --insecure https://cloud.monaca.mobi/manage/##### --data C:\myfilepath\senddata.json -H "Content-Type: application/json" --header "X-Monaca-Backend-Management-API-Key: #####"  

但它也返回这个错误:

{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"Parse error"}}

最佳答案

问题解决了。似乎在 Windows 的命令提示符下运行 curl 命令有一些问题会返回错误,例如 curl: (3) [globbing] unmatched brace in colum

如果您遇到同样的问题,请按照/重新检查以下步骤:

  1. 检查您是否在 Windows 上正确安装了 curl (http://guides.instructure.com/s/2204/m/4214/l/83393-how-do-i-install-and-use-curl-on-a-windows-machine)
  2. 安装和使用cygwin终端
    ( http://hariniachala.blogspot.com/2012/08/running-curl-commands-in-command-prompt.html )
    因为 DOS 环境似乎不喜欢单引号。任何使用单引号将值括起来的示例在 Windows 上都是无效的。单引号必须替换为双引号。

希望这对您有所帮助。

关于ios - Monaca 推送通知后端管理 API 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23410629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com