BeaconMonitor是Swift框架用来监控和排列iBeacons。
import BeaconMonitorimport CoreLocationclass ListenViewController: UIViewController { var monitor: BeaconMonitor? override func viewDidLoad() { super.viewDidLoad() monitor = BeaconMonitor(uuid: NSUUID(UUIDString: uuidTextfield.text!)!) monitor!.delegate = self monitor!.startListening() }}extension ListenViewController: BeaconMonitorDelegate { @objc func receivedAllBeacons(monitor: BeaconMonitor, beacons: [CLBeacon]) { print("All Beacons: \(beacons)") } @objc func receivedMatchingBeacons(monitor: BeaconMonitor, beacons: [CLBeacon]) { print("Matching Beacons: \(beacons)") }}点击空白处退出提示
评论