【问题标题】:How to get iBeacon CLBeaconRegion identifier (not uuid)?如何获取 iBeacon CLBeaconRegion 标识符(不是 uuid)?
【发布时间】:2020-04-04 20:55:20
【问题描述】:

无法从 CLBeaconRegion 检索标识符非常令人沮丧。这是一个简化的示例:

let beaconRegion = CLBeaconRegion(uuid: UUID(uuidString: "E2C56DB5-DFFB-48D2-B060-D0F5A71096E0")!, major: 111, minor: 222, identifier: "NewBeacon")

locationManager?.startMonitoring(for: beaconRegion)
locationManager?.startRangingBeacons(in: beaconRegion)

func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
    if let beacon = beacons.first {
        print(beacon.identifier) //that
    }
}

有没有办法获取“NewBeacon”标识符?

【问题讨论】:

    标签: ios swift core-location cllocationmanager


    【解决方案1】:

    标识符与地区相关联,可以直接访问region.identifier

    【讨论】:

    • 现在我知道我错过了 locationManager 中的整个区域参数。谢谢!
    猜你喜欢
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 2014-04-20
    • 1970-01-01
    • 1970-01-01
    • 2013-12-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多