我正在使用Air Locate示例,并仅通过UUID监视iBeacon。当我收到进入区域事件时,如果我只监视UUID(如果我监视带有指定major和minor的UUID则可以),似乎无法从触发事件的信标/区域获取major和minor - 有人知道如何解决这个问题吗?或者我是否遗漏了什么?
我不想开始扫描 - 似乎我不应该需要..
(用例是例如有许多带有相同UUID的商店,然后发出包含有关该商店的相关信息的操作系统通知(通过查询major和minor获得))
这里是我基本上要做的事情:
我不想开始扫描 - 似乎我不应该需要..
(用例是例如有许多带有相同UUID的商店,然后发出包含有关该商店的相关信息的操作系统通知(通过查询major和minor获得))
这里是我基本上要做的事情:
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...
}
非常感谢!