Ios 使用反向地理编码(Google API)提取街道名称
我正在使用谷歌反向地理编码来获取用户的当前位置。我的代码是这样的:Ios 使用反向地理编码(Google API)提取街道名称,ios,objective-c,google-maps,Ios,Objective C,Google Maps,我正在使用谷歌反向地理编码来获取用户的当前位置。我的代码是这样的: NSString* StrCurrentLongitude=[NSString stringWithFormat: @"%f", currentLocation.coordinate.longitude]; // string value NSString* StrCurrentLatitude=[NSString stringWithFormat: @"%f", currentLocation.coordin
NSString* StrCurrentLongitude=[NSString stringWithFormat: @"%f", currentLocation.coordinate.longitude]; // string value
NSString* StrCurrentLatitude=[NSString stringWithFormat: @"%f", currentLocation.coordinate.latitude];
[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/geocode/json?latlng=%@,%@&sensor=true_or_false",StrCurrentLatitude,StrCurrentLongitude]];
现在,我如何从这里继续获取用户的当前位置 在我的头顶上:
[NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithUrl:yourURL] queue:[NSOperationQueue mainQueue] completion:^(NSURLResponse *r, NSData *d, NSError *e) {
//decode it
id json = [NSJSONSerialization JSONObjectWithData:d options:0 error:nil];
//process google response, which is JSON IIRC
}];
NSURLResponse或NSData是我将接收的JSON文件吗?我如何提取地址(或解析?)?哦,我可以使用的地址在请求和completionHandler之间有一个“队列”,我应该在其中输入什么值?[NSOperationQueue mainQueue]——NSData有JSON