HI all i integrated google map in my applications, i am getting lat and long of current location and try to get place mark from those lat and long but i get strange error in my code when i used geocode.
-(void)viewDidload
{
_locationManager = [[CLLocationManager alloc] init];
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.delegate = self;
[self GetMyLocation];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:0 longitude:0 zoom:16];
_mapView = [GMSMapView mapWithFrame:self.view.frame camera:camera];
_mapView.myLocationEnabled = YES;
[_mapView setMapType:kGMSTypeNormal];
[self.firstview addSubview:_mapView];
}
- (void) GetMyLocation{
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[_locationManager startUpdatingLocation];
}
- (void)didReceiveMemoryWaing {
[super didReceiveMemoryWaing];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations: (NSArray *)locations
{
NSLog(@"My location %@", [locations lastObject]);
CLLocation *currentLocation = [locations lastObject];
[_mapView animateToLocation:currentLocation.coordinate];
[self reverseGeocode:self.location];
}
- (void)reverseGeocode:(CLLocation *)location {
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"Finding address");
if (error) {
NSLog(@"Error %@", error.description);
} else {
CLPlacemark *placemark = [placemarks lastObject];
NSLog(@"placemark %@", placemark);
//self.myAdd.text = [NSString stringWithFormat:@"%d", ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO)];
}
}];
}
I get this error in my console area Error Error Domain=kCLErrorDomain Code=8 "(null)"
