Swift2.3 code for Beacon detection

混江龙づ霸主 提交于 2019-11-29 00:45:19

There are a number of anecdotal reports of beacon detection problems on iOS 10. Symptoms include:

  • Improper region exit events, especially when the app is in the background, followed by entry events if the shoulder button is pressed.
  • Periodic dropouts in detections of ranged beacons, with callbacks providing an empty beacon list when beacons are in the vicinity.
  • Ranged beacon callbacks return proper results when a different beacon ranging or detection app is running that targets iOS 9.x.

This is presumably a bug that will be fixed in an iOS update. Until then, some users have reported that setting the app deployment target in XCode to 9.x will resolve the issue.

Try constructing your location manager after the view loads. In other words, change:

let locationManager = CLLocationManager()

to

let locationManager : CLLocationManager!

And then add this to the viewDidLoad:

locationManager = CLLocationManager()

I have seen strange behavior with LocationManager constructed on initialization of a UIViewController.

Pierre Yao

While I was testing beacon ranging, I downloaded multiple applications that I forgot to uninstall. After I uninstalled all beacon-related applications and re-installed just the needed applications, I was able to get ranging beacons to work.

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