Please, I'm new to the area and I'm creating an app that will tell the distance, speed, calories spent, and user time during a race / walk.
The simulator is finding the location, but the screen does not follow the walk, besides the view from above (commonly called "span"), get extremely far by default, and needs to start approx. >
Can you help me? Here are the parts that I deem important for a better understanding of my doubt:
Thank you very much!
// Defining location accuracy
self.gerenciadorGPS.desiredAccuracy = kCLLocationAccuracyBest
segundos = 0.0
distancia = 0.0
locations.removeAll(keepingCapacity: false)
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.atualizaSegundo(timer:)), userInfo: nil, repeats: true)
startLocationUpdates()
// Button that finds the current location @IBAction func locate (_ sender: UIButton) {
// Verificando a autorização de status
if (CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedWhenInUse && CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedAlways) {
self.gerenciadorGPS.requestWhenInUseAuthorization()
}
self.mapa.showsUserLocation = true
self.gerenciadorGPS.delegate = self
self.gerenciadorGPS.startUpdatingLocation()
var locationManager: CLLocationManager = {
var _locationManager = CLLocationManager()
_locationManager.desiredAccuracy = kCLLocationAccuracyBest
_locationManager.activityType = .fitness
// Movement threshold for new events
_locationManager.distanceFilter = 10.0
return _locationManager
let localizacao = _locationManager
let span = MKCoordinateSpanMake(0.04, 0.04)
let regiao = MKCoordinateRegionMake(_locationManager as! CLLocationCoordinate2D, span)
}()