iBeacons: If app is in background, locationManager: didEnterRegion: is called only when lock screen displayed

纵饮孤独 提交于 2019-12-05 01:24:49

Just trying to get more info. Have you set notifyEntryStateOnDisplay to YES on the CLBeaconRegion? It sounds like it.

From documentation:

When set to YES, the location manager sends beacon notifications when the user turns on the display and the device is already inside the region. These notifications are sent even if your app is not running. In that situation, the system launches your app into the background so that it can handle the notifications. In both situations, the location manager calls the locationManager:didDetermineState:forRegion: method of its delegate object.

The default value for this property is NO.

I had a similar issue as well and tried various code level changes detailed above (and other posts). Ranging worked but the Enter and Exit zone detection did not.

It turned out that I had App Background Refresh off. Once I enabled background app refreshing the Entering and Exiting of the zones worked correctly.

I've had the exact same problem. I was sure I've set everything ok.

The solution was very easy: just remove the app from the device completely and run it again in Xcode . It worked for me like a charm.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!