BeaconKit Build Status Current Version

使用 Swift 编写的,基于 CoreBluetooth 的 Beacon 检测框架

概要

这是一个围绕 CoreBluetooth 封装的框架,用于检测不同类型的 Beacon。

已测试可在 iOS 9.0 和 macOS 10.12 下使用 Swift 4.0 和 4.2 编译。

目前支持的类型有:Eddystone-UIDEddystone-URLAltBeaconiBeacon

iBeacon 检测仅适用于 macOS。在 iOS 上无法使用 CoreBluetooth 检测 iBeacon(有关更多信息,请参见此说明)。

仅支持前台操作,但我计划添加 Eddystone 的后台检测(无法在后台检测 AltBeacon)。

用法

激活

BeaconScanner.shared.delegate = self
BeaconScanner.shared.start()

如果要更改检测到的 beacon,请按如下方式赋值给 recognizedBeaconTypes

BeaconScanner.shared.recognizedBeaconTypes = [EddystoneUidBeacon.self, EddystoneUrlBeacon.self, AltBeacon.self] 

停用

BeaconScanner.shared.stop()

支持的 Beacon 类型

已知不支持的 Beacon 类型