如何获取iBeacon CLBeaconRegion标识符(不是uuid)?

问题描述 投票:0回答:1

无法从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个回答
0
投票

标识符与该区域相关联,您只需访问region.identifier

© www.soinside.com 2019 - 2024. All rights reserved.