How to reset region center when exited region in background using CoreLocation
My idea is simple in theory, but am having a really hard time executing it. I want to create a geofence at the user's location, and when the user exits that region, I want to recenter the region at the user's updated location. Here is the flow:
Sometimes this all works, but more often than not, the geofence doesn't recenter correctly. What's been happening is that the region is re-centered and locationManager:didExitRegion: is immediately called, which puts it into an infinite loop until the app is terminated again. Since it is terminated without a valid monitored region, the app then won't be woken up for location updates.
Is this incorrect usage of region monitoring? I'm trying to play with different ways of tracking user location in a battery efficient way (and not constantly using the standard startUpdatingLocation). Would a combination of signification location change tracking and visit monitoring be more effective?
Thanks!
链接地址: http://www.djcxy.com/p/20352.html