Created
August 21, 2019 05:53
-
-
Save susanna2222/6076df195c02124aa20b632eced10fde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func setupLocationManager(){ | |
if CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedAlways{ | |
// Request to get alwayls location authorization | |
locationManager.requestAlwaysAuthorization() | |
} | |
// set delegate for location manager | |
locationManager.delegate = self | |
// setup attributes of location manager | |
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