我正在使用空中定位示例并仅通过 uuid 监视 iBeacons。当我得到输入的区域事件时,如果我只是在寻找 uuid,我似乎无法从触发事件的信标/区域中获取主要和次要(如果我正在监视 uuid 则可以)指定的主要和次要) - 有人知道这样做的方法/我错过了什么吗?
我真的不想开始测距-似乎我不需要……
(用例是说许多商店都使用具有相同 uuid 的信标,然后发出操作系统通知,其中包含有关该商店的相关信息(通过查询主要和次要获得))
这基本上是我所做的:
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid
identifier:@"blah"];
region.notifyOnEntry = YES;
region.notifyOnExit = YES;
region.notifyEntryStateOnDisplay = YES;
[self.locationManager startMonitoringForRegion:region];
然后在应用委托中:
- (void) locationManager:(CLocationManager*)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion*)region {
// assume for now its the iBeacon
CLBeaconRegion *beaconRegion = (CLBeaconRegion*) region;
beaconRegion.major // hasn't been set...
}
非常感谢!