didEnterRegion called multiple times in sdk 3.8.1/firmware 3.2.0

Hi,

Up until now we used IOS sdk 3.2.12 and beacons with firmware 3.0.1. After upgrading both sdk to 3.8.1 and firmware to 3.2.0, we started to receive didEnterRegion/didExitRegion 10 times instead of 1 as before.

scenario:

  1. app is in foreground and monitoring has started. beacon is upside down and no events emited.
  2. beacon is flipped.
  3. 10 events of didEnterRegion are received with the same region one after another.

----logs-----

2015-12-02 21:00:09:384 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:396 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:402 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:408 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:414 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:421 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:427 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:434 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:439 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D
2015-12-02 21:00:09:445 xxx[3895:807] inside enter with uuid B9407F30-F5F8-466E-AFF9-25556B57FE6D

------end-------

Is it a bug or defined behaviour? How should we deal with it?

Best,
Victor

Hmm, do you only start monitoring for a single region? Can you log the region’s identifier, UUID, major and minor?

Also, monitored regions persist between app restarts, so if you started the monitoring in the past and never stopped, your app is likely still monitoring these regions. You can investigate the monitoredRegions property to see which regions are still being monitored, and stop them. Or you can reinstall the app for a “clean slate.”

Indeed cleaning both monitoredRegions and rangedRegions fixed the issue. What is this feature good for? How can I use it?

Currently once app is started we purge the monitoredRegions list and assign the needed regions anew. Is this a good practice?

Personally, I find this much more of a problem during development stage, than in production.

When actively developing the app, you often mess around with the region definitions, and rarely remember to clean things up.

In production, you likely already have some logic for starting/stopping monitoring—e.g., use GPS to only monitor for beacons in the venue you’re closest too, etc. Since monitoring persist throughout app restarts, iPhone restarts, etc., you never actually need to “restart” monitoring.

That’s the “ideal world” scenario though, and in practice, many developers opt to do exactly what you mentioned—clean out all the monitored regions on app launch and do “restart” monitoring. Prevents weird things from occurring should the start/stop monitoring logic fail (and as we all know, there’s no bugless software :wink:)—so yeah, I’d consider it a very practical practice (: