Hallo woran kann es legen das der Standort von meiner Wetter App 50 km daneben liegt obwohl ich als reichweite 100 m eingegeben habe ? Hier ist ein Teil des Codes.
Alles anzeigen
Quellcode
- func setupLocationmanager() {
- locationManager.delegate = self
- locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
- locationManager.requestWhenInUseAuthorization()
- locationManager.startUpdatingLocation()
- }
- func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
- let location = locations[locations.count - 1]
- if location.horizontalAccuracy > 0 {
- locationManager.stopUpdatingLocation()
- locationManager.delegate = nil
- }
- let latitude = Int(location.coordinate.latitude)
- let longitude = Int(location.coordinate.longitude)
- let url = WETTER_URL_BY_CORDINATES + "lat=\(latitude)&lon=\(longitude)" + "&appid=\(ID)" + "&units=\(UNIT)" + "&lang=\(LANGUAGE)"
- getWeatherData(url: url)
- }