class LocationHelper{
var locationManager:CLLocationManager
init(){
locationManager = CLLocationManager()
locationManager.startMonitoringLocationPushes(completion: onMonitorUpdated)
}
func request(){
let status = locationManager.authorizationStatus
print(status == .authorizedAlways)
locationManager.requestAlwaysAuthorization()
}
func onMonitorUpdated(data:Data?, error:Error?){
print(" error:\(error?.localizedDescription)")
guard let data = data else {
return
}
let token = data.reduce("", {$0 + String(format: "%02X", $1)})
print("token is:\(token)")
}
}