Which UIApplicationDelegate methods get called when my app receives a significant location change?
-
28-09-2019 - |
Question
I have set my app to listen to significant location changes using startMonitoringSignificantLocationChanges
of CLLocationManager
.
So when the device's location changes significantly, my app gets some execution time to handle this change. But what methods of UIApplicationDelegate
are called? applicationDidEnterBackground
? applicationWillEnterForeground
?
It's a pain for me to test stuff like this since I don't have a MacBook and it's not possible to simulate these location changes.
Solution
startMonitoringSignificantLocationChanges Documentation
This method initiates the delivery of location events asynchronously, returning shortly after you call it. Location events are delivered to your delegate’s locationManager:didUpdateToLocation:fromLocation: method. The first event to be delivered is usually the most recently cached location event (if any) but may be a newer event in some circumstances. Obtaining a current location fix may take several additional seconds, so be sure to check the timestamps on the location events in your delegate method.
you need to implement the delagate methods associated with CLLocationManagerDelegate, your application will not respond appropriately until then.