OneShotLocationManager
OneShotLocationManager copied to clipboard
After disable the location services manually and enable it again after some times location issue
After disable the location services manually and enable it again after some times the locationmanager fetchWithCompletion method not calling.
self.locationManager = OneShotLocationManager()
self.locationManager!.fetchWithCompletion {location, error in
// fetch location or an error
if let loc = location {
print(loc.description)
let latNum:NSNumber = (location?.coordinate.latitude)!
let lngNum:NSNumber = (location?.coordinate.longitude)!
} else if let err = error {
print(err.localizedDescription)
}
// destroy the object immediately to save memory
self.locationManager = nil
}
I think always check the location services wheather enable or diable it based on that call the fetchWithCompletion block.