Why didUpdateLocations is not called in the suspended state?

Why didUpdateLocations is not called in the suspended state?(after cache cleared).


This working in foreground & background only. I have followed below steps,


1) Set capabilities for background modes, checked Location updates & Background fetch

2) Added key to your

Info.plist
and request authorization from the location manager asking it to start.
  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysUsageDescription

3) locationManger = CLLocationManager()

locationManger.delegate = self

app = UIApplication.shared

locationManger.allowsBackgroundLocationUpdates = true

locationManger.desiredAccuracy = 45

locationManger.distanceFilter = 100

locationManger.startMonitoringSignificantLocationChanges()


Let me know where i am wrong.


Any help would be highly appreciated.

Replies

Need to add `startMonitoringSignificantLocationChanges` inside `DispatchQueue.main.async{}`.

And do add those two above mentioned keys under info.plist.


I know the replying now after almost 4 yesr of posting this question may not help you but it will to someone looking for the same.