Objective C Google 张地图

Objective C Google maps

下面是我获取位置经纬度的代码,但无论何时执行它 returns this:

You have exceeded your daily request quota for this API. We recommend registering for a key at the 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");
    }
}];

为此,您需要注册您的应用程序并获取 API 密钥。您需要在每个请求中使用此 API 密钥,方法是将其附加 URL:

NSString *sendtourl = [NSString stringWithFormat:@"https://maps.google.com/maps/api/geocode/json?sensor=false&address=%@?key=your key", givensource];