【发布时间】:2013-12-20 05:19:13
【问题描述】:
我正在使用 Google Map API 通过 ATM 获取附近的纬度和经度。我通过我的 Google 凭据获得了 Google API 密钥。我通过我的应用程序请求代码
NSString *url = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search /json?location=%f,%f&radius=%@&types=%@&sensor=true&key=%@", currentCentre.latitude, currentCentre.longitude, [NSString stringWithFormat:@"%i", currenDist], googleType, kGOOGLE_API_KEY];
NSURL *googleRequestURL=[NSURL URLWithString:url];
NSData* data = [NSData dataWithContentsOfURL: googleRequestURL];
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
我得到了
{
"debug_info" = (
);
"html_attributions" = (
);
results = (
);
status = "REQUEST_DENIED";
} as response.
请告诉我该怎么做??
【问题讨论】:
-
首先删除网址中不必要的空格。
-
我的代码中没有空格,这些只出现在这里...我也收到了响应...但状态是“REQUEST_DENIED”,但我有 API 密钥并且已经启用将 API 和 Google MAP 放在 API 访问部分..
-
你能发布你的最终网址吗?
标签: ios objective-c google-maps