【发布时间】:2014-03-05 02:36:51
【问题描述】:
我正在尝试以与使用 Firefox 浏览器类似的方式从我的移动应用程序中使用 Maps API:
http://maps.googleapis.com/maps/api/geocode/json?address=First Avenue New York Manhattan&sensor=true
不幸的是,我总是收到这个错误结果:The 'sensor' parameter specified in the request must be set to either 'true' or 'false'
我试过TRUE、True、true...不行。
我还尝试按照本指南使用与我的 google 帐户关联的 API 密钥:https://developers.google.com/maps/documentation/javascript/tutorial?hl=it#api_key
事实上,我做到了:
所以,最后,我想我的问题与我准备的 POST 请求有关。 这是我用于请求的代码:
request = new CIwHTTP; // The http pointer
const char* c1 = text.getCString(); // This is the string "address=First Avenue New York Manhattan&sensor=true"
int length = strlen(c1);
request->SetRequestHeader("Content-Type", "text/javascript; charset=utf-8");
request->Post("http://maps.googleapis.com/maps/api/geocode/json", c1, length, callback, NULL);
在回调中我得到了我的结果字符串,希望来自 Google 的 JSON 字符串告诉我地址列表。我对 Header 不太确定,但我更改了其中的几个而没有结果。
我使用 Marmalade,所以我的代码完全是 C++。
你能帮帮我吗?
【问题讨论】:
标签: json api google-maps google-maps-api-3