SO, ich bin hier zu schnell und ich machte die Umwandlung von Strom Lat und Long City Namen und Land, funktioniert es so gut:Wie erzwinge Standardsprache in CLLocationManager zu Englisch?
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
if didFindLocation == false
{
didFindLocation = true
locationManager.stopUpdatingLocation()
userLocation = locations[0]
long = userLocation.coordinate.longitude;
lat = userLocation.coordinate.latitude;
print("\(lat),\(long)")
converLocationToCity()
}
}
func converLocationToCity()
{
let geoCoder = CLGeocoder()
userLocation = CLLocation(latitude: self.lat, longitude: self.long)
geoCoder.reverseGeocodeLocation(userLocation, completionHandler:
{
(placemarks, error) -> Void in
var placeMark: CLPlacemark!
placeMark = placemarks?[0]
if let city = placeMark.addressDictionary!["State"] as? String
{
self.city = city as String
} else
{
self.city = ""
}
if let country = placeMark.addressDictionary!["Country"] as? String
{
self.country = country as String
} else
{
self.country = ""
}
self.currentCity.name = ("\(self.city), \(self.country)" as String)
print("\(self.currentCity.name)")
self.fetchWeather.performCurrentWeatherFetch(forSelectedCity: self.currentCity.name)
DispatchQueue.main.async()
{
(self.superview as! UICollectionView).reloadData()
}
})
}
Aber, wenn das Gerät auf eine andere Sprache eingestellt ist, Russisch für Zum Beispiel gibt es mir den Namen der Stadt und das Land in russischen Schriftzeichen zurück, aber ich brauche es nur auf Englisch, bitte irgendwer irgendwelche Ideen oder Vorschläge? Vielen Dank!
http://stackoverflow.com applelanguage auf Standardwert setzt/questions/25144508/reverse-geocoding-to-return-result-only-in-english –
mm es scheint zu sein, was ich brauche, aber es ist in Objective und ich bin neu in der Programmierung und schnell, also versuche ich für 40 Minuten schon und kann es nicht schaffen ... –