I am using this code in which i am getting Placemark but it not giving the city name.
Earlier i am using MKReverse Geocoder to get the placemark in which i am getting the city name but as in ios6 it showing deprecated because the apple developer added every thing in CLLocation.
so i used this code. `-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLLocation *location = [locationManager location];
NSLog(@"location is %@",location);
CLGeocoder *fgeo = [[[CLGeocoder alloc] init] autorelease];
// Reverse Geocode a CLLocation to a CLPlacemark
[fgeo reverseGeocodeLocation:location
completionHandler:^(NSArray *placemarks, NSError *error){
// Make sure the geocoder did not produce an error
// before continuing
if(!error){
// Iterate through all of the placemarks returned
// and output them to the console
for(CLPlacemark *placemark in placemarks){
NSLog(@"%@",[placemark description]);
city1= [placemark.addressDictionary objectForKey:(NSString*) kABPersonAddressCityKey];
NSLog(@"city is %@",city1);
}
}
else{
// Our geocoder had an error, output a message
// to the console
NSLog(@"There was a reverse geocoding error\n%@",
[error localizedDescription]);
}
}
];
}
`
here as i am seeing in console in NSLog(@"%@",[placemark description]);
its giving output like :- abc road name,abc road name, state name,country name.
any help please .Thanking in advance.