iOS谷歌地图 - 搜索地点

时间:2014-07-16 13:27:40

标签: ios xcode google-maps google-places-api google-geocoding-api

我正在开发iOS地图,该地图使用Google地图搜索和显示附近的药房。我启用了以下API:地理编码API,适用于iOS的Google Maps SDK,Places API。 我创建了一个浏览器密钥,一个iOS密钥和一个服务器密钥。

NSString *str = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=%f,%f&radius=500&types=food&name=cruise&key=MY_KEY",location.coordinate.latitude, location.coordinate.longitude];

NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:str]
                                          cachePolicy:NSURLRequestUseProtocolCachePolicy
                                      timeoutInterval:60.0];

NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if (theConnection)
{
    receivedData = [NSMutableData data];
}

连接完成后使用浏览器密钥:

  

"提供的API密钥已过期。"

连接完成后使用app键:

  

"此IP,网站或移动应用程序无权使用此API   。关键"

可能是什么问题?

0 个答案:

没有答案