i write code of CLGecoder and the code are
-(NSString *)GetCurrentAddress:(CLLocation *)Location
{
__block NSString *locatedaddress;
CLGeocoder *Gecoder=[[CLGeocoder alloc]init];
[Gecoder reverseGeocodeLocation: Location completionHandler:
^(NSArray *placemarks, NSError *error) {
//Get address
CLPlacemark *placemark = [placemarks objectAtIndex:0];
NSLog(@"Placemark array: %@",placemark.addressDictionary );
//String to address
locatedaddress = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];
//Print the location in the console
NSLog(@"Currently address is: %@",locatedaddress);
}];
return locatedaddress;
}
Problem is locatedaddress inside The completionHandler Has Value But Outside Is Not ? Any One Can Help Me ? Thanks In Advance.