user3617723
user3617723

Reputation: 1395

iOS didRangeBeacons called after didExitRegion

I'm experiencing a strange problem with iBeacon monitoring in iOS.

The test I'm running is,

1.Start monitoring for beacon region.

2.Wait a few seconds and then turn on the beacon.

3.didEnterRegion is called and I call startRangingBeacons.

4.I start receiving regular callbacks through didRangeBeacons.

5.I turn the beacon off, and continue to get didRangeBeacon callbacks for a second or two.

6.Then I receive didExitRegion.

7.Now the weird bit, I then get one further call to didRangeBeacons.

If I turn the beacon back on after this then didEnterRegion is not called, despite the fact that didExitRegion was called. It seems like the rougue call to didRangeBeacons means iOS now thinks the beacon is in range again.

Is this the behaviour people would expect? Or does this indicate a problem with my code?

EDIT:

I'm seeing this behaviour on an iPhone 4 running 7.0.6, if i run the same test with a 5C running 7.1 and a 5S running 7.1.1 everything is fine.

Upvotes: 0

Views: 507

Answers (1)

Kasper Munck
Kasper Munck

Reputation: 4191

I wouldn't expect that behaviour either. However, in the discussion of didRangeBeacons:inRegion: it says:

The location manager calls this method whenever a beacon comes within range or goes out of range

This could be the explanation of the behaviour you are referring to in bullet 7.

It is not mentioned, however, whether this goes out of range call is performed before or after the monitor delegate calls. Similarly, this does not explain why you are no longer receiving didEnterRegion: calls.

Upvotes: 0

Related Questions