When i call
geocoder reverseGeocodeLocation:currentLoc completionHandler:
i get all the data (city, county, ...) in a language according to locale set on iphone.
How can i force to always get this data in English?
For future readers, the accepted answer is not true (at least not any more).
UserDefaults.standard.set(["en"], forKey: "AppleLanguages")
gc.reverseGeocodeLocation(loc) {
print($0 ?? $1!)
UserDefaults.standard.removeObject(forKey: "AppleLanguages")
print(UserDefaults.standard.object(forKey: "AppleLanguages") as! [String])
}
Calling removeObject(forKey:)
is important since you want to reset the returned value in UserDefaults
to the system settings. Some answers make you hold the original value from calling UserDefaults.standard.object(forKey: "AppleLanguages")
and set it after getting the address, but this will stop your UserDefaults
from being in sync with the global Language Preferences in iOS "Settings" app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With