not getting proper current address google map sdk iOS
I am using googlemap sdk but not able to find current location properly on device like in goole map.
I am getting proper latitude and longitude when I paste this latitude and longitude in browser I am getting proper full address with House No. but not getting House No. in GMSAddress . Here's my code:
(void)viewWillAppear:(BOOL)animated { [mapView_ addObserver:self forKeyPath:@"myLocation" options:0 context:nil]; }
(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if([keyPath isEqualToString:@"myLocation"]) { CLLocation *location = [object myLocation]; //... NSLog(@"Location, %@,", location);
CLLocationCoordinate2D target =
CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude);
lat=location.coordinate.latitude;
lon=location.coordinate.longitude;
[[GMSGeocoder geocoder] reverseGeocodeCoordinate:CLLocationCoordinate2DMake(lat, lon) completionHandler:^(GMSReverseGeocodeResponse* response, NSError* error) {
NSLog(@"reverse geocoding results:");
for(GMSAddress* addressObj in [response results])
{
NSDictionary*dict=[response results];
NSLog(@"coordinate.latitude=%f", addressObj.coordinate.latitude);
NSLog(@"coordinate.longitude=%f", addressObj.coordinate.longitude);
NSLog(@"thoroughfare=%@", addressObj.thoroughfare);
NSLog(@"locality=%@", addressObj.locality);
NSLog(@"subLocality=%@", addressObj.subLocality);
NSLog(@"administrativeArea=%@", addressObj.administrativeArea);
NSLog(@"postalCode=%@", addressObj.postalCode);
NSLog(@"country=%@", addressObj.country);
NSLog(@"lines=%@", addressObj.lines);
}
}];
} }
上一篇: 当ts错误410时,avplay停止