Skip to content

Instantly share code, notes, and snippets.

@susanna2222
Created August 20, 2019 03:02
Show Gist options
  • Select an option

  • Save susanna2222/3fce77f57cd97808e7f878dbfc0e3d68 to your computer and use it in GitHub Desktop.

Select an option

Save susanna2222/3fce77f57cd97808e7f878dbfc0e3d68 to your computer and use it in GitHub Desktop.
func setupLocationManager(){
// set delegate for location manager
if CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedAlways{
// Request to get alwayls location authorization
locationManager.requestAlwaysAuthorization()
}
locationManager.delegate = self
locationManager.distanceFilter = 1
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.allowsBackgroundLocationUpdates = true
locationManager.pausesLocationUpdatesAutomatically = false
locationManager.showsBackgroundLocationIndicator = true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment