Reputation: 10348
For some strange reason sometimes when I enter a region, the didEnterRegion gets triggered as much as 10 times. Does anyone know what are the possible reasons this can happen? I know that may happen if I'm at a boundary but maybe Apple has smart logic not trigger at those points.
Whats up with this??
Upvotes: 2
Views: 1583
Reputation: 14164
I've seen that when you have multiple instances of your CLLocationManager instantiated. Say you have multiple classes that need to use the location, you alloc/init the location manager 4-5 times in your app life-cycle... they are all listening for delegate methods.
So, if I only have 4-5 instances, why do I get 10 callbacks? Glad you asked. :p I believe there is a bug in Apple's region monitoring delegate methods that fire twice for each instance.
The solution would be to create your own singleton class for the location manager delegate and just use the one instance of your location manager for the whole application. This will prevent you from getting 4-5 x 2 callbacks. Then you'll only get 2 like everyone else.
If you would like to help, duplicate the radar in my answer on this question so we can get Apple to fix the issue once and for all.
why the didEnterRegion called twice ?
Upvotes: 1