我正在尝试检测多个 iBeacon。我在它们附近放置了三个 iBeacon。
问题一一检测。不在数组中。它应该返回 3 个 iBeacons。
self.beaconManager = [[ESTBeaconManager alloc] init];
self.beaconManager.delegate = self;
self.region1 = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:21668 minor:53482 identifier:@"EstimoteSampleRegion"];
self.region2= [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_MACBEACON_PROXIMITY_UUID major:3894 minor:57726 identifier:@"EstimoteSampleRegion2"];
self.region3= [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_IOSBEACON_PROXIMITY_UUID major:13067 minor:31901 identifier:@"EstimoteSampleRegion3"];
[self.beaconManager startRangingBeaconsInRegion:_region1];
[self.beaconManager startRangingBeaconsInRegion:_region3];
[self.beaconManager startRangingBeaconsInRegion:_region2];
// 委托方法
-(void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region {
//checks bRegion, so you could have it searching for other beacons if you wanted after one is notified
NSLog(@"Start");
for (ESTBeacon *iBeacon in beacons) {
NSLog(@"%@",iBeacon.minor);
}
NSLog(@"Finish");
}
控制台 O/p
Start
57726
Finish
Start
53482
Finish
Start
31901
Finish
Start
57726
Finish