5

I have been doing some reading about CLBeaconRegion and I have setup some iBeacons successfully and had it trigger location updates, even while the application is in the background.

However, from what I've read and carry over from CLRegion, I understand that it should be possible to hit locationManager:didEnterRegion: after the application is terminated.

I've setup my CLBeaconRegion like this:

beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:SERVICE_UUID]
                                                       major:0
                                                       minor:0
                                                  identifier:BEACON_ID];
[beaconRegion setNotifyOnEntry:YES];
[beaconRegion setNotifyOnExit:YES];
[beaconRegion setNotifyEntryStateOnDisplay:YES];

But I am not able to trigger the CLLocationManager's delegate from termination. I've left the region (confirmed by a notification), travelled further away from the beacon, waited for 30 seconds, then travelled back to the beacon, but it does not trigger the delegate while terminated (works great while in the background and foreground).

Should this work from termination? Am I missing something? Any help would be great.

4

4 回答 4

4

我相信,当您在后台或未运行时,它会调用 locationManager:didDetermineState:forRegion: 而不是 locationManager:didEnterRegion:,然后仅当您将 notifyEntryStateOnDisplay 设置为 TRUE 时。

于 2013-10-23T00:51:30.713 回答
1

这是 iOS 7 上的预期行为。但是,此行为在 iOS 7.1 下已更改。iOS 7.1 将委托调用恢复为 iOS 7 之前的行为。

我已经在我的博客文章中记录了这种行为。

http://www.simplymadeapps.com/blog/2014/03/7-1-brings-back-geofence-behavior/

于 2014-03-28T16:01:53.473 回答
1

编辑:从 7.1 开始,以下内容不再适用。即使应用程序关闭,您仍然可以收到通知

在应用程序切换器中滑动的应用程序行为现在具有您在 iOS 7 下描述的效果。

从切换器中删除您的应用程序的用户已决定不允许您的应用程序在后台运行。因此,区域监控不会重新打开您的应用程序。

查看 WWDC 2013 的“多任务处理的新功能”会话以获取更多信息。

于 2013-10-29T22:20:55.667 回答
-1

是的,

 Same behaviour is being noticed .Sometimes even while calling setNotifyEntryStateOnDisplay, didEnterRegion not called even when in foreground.
于 2013-12-18T11:21:59.337 回答