Reputation: 3561
I have an app that is ranging beacons in the background. When I initialize my CLLocationManager instance I'm starting things off with the startMonitoringForRegion
method. I am handling the locationManager:didEnterRegion
, locationManager:didExitRegion
, and locationManager:didDetermineState:ForRegion
delegate methods. Within those methods I am turning ranging on/off.
This all seems to work great except when the CLLocationManager
is initialized when the user is already present within the region. In that case neither locationManager:didEnterRegion
nor locationManager:DidDetermineState:ForRegion
are called until after I exit and then re-enter the region. I was always under the impression that this would at least trigger locationManager:DidDetermineState:ForRegion
but that does not appear to be the case.
Is there a way to determine if the user is initially within the region when I first fire off startMonitoringForRegion
?
Upvotes: 5
Views: 1049
Reputation: 2513
You can invoke the manager's requestStateForRegion
method. This will cause your delegate's didDetermineState
method to be called asynchronously.
Upvotes: 7