Ios 目标C谷歌地图
下面是我获取位置纬度和经度的代码,但每当执行时,它都会返回以下内容: 您已超过此API的每日请求配额。我们建议在Google开发者控制台注册密钥 我有我的API密钥,但我不知道放在哪里Ios 目标C谷歌地图,ios,objective-c,iphone,google-maps-sdk-ios,Ios,Objective C,Iphone,Google Maps Sdk Ios,下面是我获取位置纬度和经度的代码,但每当执行时,它都会返回以下内容: 您已超过此API的每日请求配额。我们建议在Google开发者控制台注册密钥 我有我的API密钥,但我不知道放在哪里 GoogleMapsViewController *obj=[self.storyboard instantiateViewControllerWithIdentifier:@"googlemap"]; NSString *givensource=self.sourcetxt.text; NSString *gi
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");
}
}];
为此,您需要注册应用程序并获取API密钥。您需要在每个请求中使用此API密钥,方法是将其附加URL:
NSString *sendtourl = [NSString stringWithFormat:@"https://maps.google.com/maps/api/geocode/json?sensor=false&address=%@?key=your key", givensource];
如何附加@Rohit KPI已经有一个密钥并注册了我的应用程序,但不知道RequestText的正确语法将您的密钥替换为数字密钥这是文档