0
please, I am new in the area and am creating an app that will count the distance, speed, calories spent and time by the user during a run/walk.
the simulator is finding the location, but the screen does not follow the walk, besides the view from above (commonly called "span"), stay extremely far by default, and need it already start approximate.
Can you help me? Below are the parts that I think are important for a better understanding of my doubt:
Thank you all very much!
// Defining the 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 locates the current location @Ibaction works to 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)
}()