Ios7 Google放置API查询请求被拒绝
我已经阅读了数十篇关于谷歌Places查询返回请求的评论,但似乎没有任何内容能说明我的情况。应用程序是IOS7和Xcode 5.0.2 我有一个用于IOS应用程序的API密钥。在Google开发者控制台中,应用程序包标识符列在凭据页面中,并启用了Places API 以下是代码的核心:Ios7 Google放置API查询请求被拒绝,ios7,google-api,google-places-api,Ios7,Google Api,Google Places Api,我已经阅读了数十篇关于谷歌Places查询返回请求的评论,但似乎没有任何内容能说明我的情况。应用程序是IOS7和Xcode 5.0.2 我有一个用于IOS应用程序的API密钥。在Google开发者控制台中,应用程序包标识符列在凭据页面中,并启用了Places API 以下是代码的核心: -(void)queryGooglePlaces: (NSString *)googleType { NSString *url = [NSString stringWithFormat:@"https:
-(void)queryGooglePlaces: (NSString *)googleType {
NSString *url = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=%f,%f&radius=%@&types=%@&sensor=false&key=%@", currentCenter.latitude, currentCenter.longitude, [NSString stringWithFormat:@"%i",currenDist], googleType, kGOOGLEAPIKEY];
NSLog(@"And the url string is: %@", url);//caveman debuging
NSURL *googleRequestURL = [NSURL URLWithString:url];
dispatch_async(kBgQueue, ^{
NSData *data = [NSData dataWithContentsOfURL:googleRequestURL];
[self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES];
});
}//queryGooglePlaces:googleType
-(void)fetchedData:(NSData *)responseData {
//this is to parse out the json data
NSError *error = nil; //create some error handling here
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
//I'm told the returned results from Google will be an array obtained from the NSDictionary object with the key "results"
NSArray *places = [json objectForKey:@"results"];
//display the data to the console for review
NSLog(@" Google data:\n%@", places);
}//fetchedData:responseData
调试输出中的效果显示json status=Request Denied
“状态”0x09a37d10键
值\uu NSCFString*@“请求\u被拒绝”0x17961870
这是url字符串的日志,
url字符串为:
我已重新生成API密钥,但没有任何效果
任何帮助都将不胜感激 Google Places API不适用于客户端标识的应用程序包标识符方法。您必须创建一个服务器密钥并将该密钥附加到您请求的URL,作为您在URL字符串中列出的
key
参数的参数。Google Places API不适用于客户端标识的应用程序包标识符方法。您必须创建一个服务器密钥并将该密钥附加到您请求的URL,作为您在URL字符串中列出的key
参数的参数。使用Google Places API的浏览器密钥,它在iOS应用程序上运行良好。在过去的两天里,我遇到了类似的问题,通过使用浏览器键解决了这个问题
你已经读过谷歌集团:
“Google Places API当前不支持从Google API控制台生成的Android或iOS密钥。当前仅支持服务器和浏览器密钥。”
希望它有助于使用Google Places API的浏览器键,它在iOS应用程序上运行良好。在过去的两天里,我遇到了类似的问题,通过使用浏览器键解决了这个问题 你已经读过谷歌集团: “Google Places API当前不支持从Google API控制台生成的Android或iOS密钥。当前仅支持服务器和浏览器密钥。”
希望有帮助我误解了这一点。谢谢,我误解了。谢谢,谢谢!几个星期以来,我一直在为这件事发愁。浏览器键起作用。如果有帮助,您可以将其标记为答案。因此,它可以帮助其他人了解您将在HTTP REFERERS值中输入什么?请将HTTP Referer框留空。使用浏览器键进行同步调用可以正常工作,但异步调用会拒绝请求。它可能会帮助一些人,谢谢!几个星期以来,我一直在为这件事发愁。浏览器键起作用。如果有帮助,您可以将其标记为答案。因此,它可以帮助其他人了解您将在HTTP REFERERS值中输入什么?请将HTTP Referer框留空。使用浏览器键进行同步调用可以正常工作,但异步调用会拒绝请求。它可能会帮助某人