CLLocationManager reverseGeocodeLocation Language
core-location, ios, xcode
Solution
I managed to figure it out eventually so this is for those who might need it as well.
- Get the "AppleLanguages" key from SUserDefaults standardUserDefaults and save it for later.
- Set the "AppleLanguages key to only "en"
- Grab the location (Now it's only in english)
- Restore the "AppleLanguages" key from before.
//1+2
NSArray *currentLanguageArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] setObject: [NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
//get the location
//4
[[NSUserDefaults standardUserDefaults] setObject:currentLanguageArray forKey:@"AppleLanguages"];
Hope that helps
Problem
I'm using CLLocationManager on iPhone to get the current user location, then I use reverseGeocodeLocation to convert the location to an address. This works fine but the results are returned in the device language and I need them to always be in english. Is there a way to get the Address string in a desired language or convert it ? ``` [geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) { NSLog(@"Found placemarks: %@, error: %@", placemarks, error); if (error == nil && [placemarks count] > 0) { placemark = [placemarks lastObject]; } ```