I'm looking for a solution similar to these two questions
- how to localize address result from reverseGeocodeLocation?
- Reverse geocoding to return results only in English?
But I want to be able to get a non-localized version of address and locality.
In my add, when doing reverse geocoding on a non-latin localized device geocoding service returns CLPlacemark
which already contains a localized version of address. For instance in Geneva, when using iPhone in Russian, I'm getting
"Площадь Пленпале" instead of "Place de Plainpalais"
which is probably cool but nonetheless confusing since street names aren't in cyrillic. Also, I'm unable to submit a localized version of the address to another API to find an itinerary. So is there a way to force a locale in reverseGeocodeLocation
or briefly trick the OS into thinking locale language is set to something other?
Also, doing something like this just before the request doesn't seem to work, since it requires app restart
NSUserDefaults.standardUserDefaults().setObject("fr", forKey: "AppleLanguages"
NSUserDefaults.standardUserDefaults().synchronize()
It turns out modifying UserDefaults was not possible (at least I found no viable solution to do that), so I had to use external reverse geocoder to what I wanted (force locale). Here's one using Google API and Alamofire and SwiftyJSON, wrapped in with a nice completionHandler to get the address when geocoding is done