Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 目标C谷歌地图_Ios_Objective C_Iphone_Google Maps Sdk Ios - Fatal编程技术网

Ios 目标C谷歌地图

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

下面是我获取位置纬度和经度的代码,但每当执行时,它都会返回以下内容:

您已超过此API的每日请求配额。我们建议在Google开发者控制台注册密钥

我有我的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");
    }
}];

为此,您需要注册应用程序并获取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的正确语法将您的密钥替换为数字密钥这是文档