【发布时间】:2016-02-23 13:36:05
【问题描述】:
下面是我获取位置纬度和经度的代码,但无论何时执行它都会返回:
您已超出此 API 的每日请求配额。我们建议在 Google Developers Console 中注册密钥。
我有我的 API 密钥,但我不知道把它放在哪里。
GoogleMapsViewController *obj=[self.storyboard instantiateViewControllerWithIdentifier:@"googlemap"];
NSString *givensource=self.sourcetxt.text;
NSString *givendest=self.destinationtxt.text;
NSString *sendtourl=[NSString stringWithFormat:@"https://maps.google.com/maps/api/geocode/json?sensor=false&address=%@",givensource];
NSURL *url = [NSURL URLWithString:sendtourl];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[NSURLConnection
sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (data.length > 0 && connectionError == nil) {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
NSLog(@"ABC");
}
}];
【问题讨论】:
标签: ios objective-c iphone google-maps-sdk-ios