这是我的代码:
// Initialize and monitor regions for (NSString *serviceUUID in _serviceUUIDs) { // Initialize region NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:serviceUUID]; CLBeaconRegion *appBeaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:SERVICE_IDENTIFIER]; // Specify notifications appBeaconRegion.notifyEntryStateOnDisplay = YES; appBeaconRegion.notifyOnEntry = YES; appBeaconRegion.notifyOnExit = YES; // Add to regions [_appBeaconRegions addObject:appBeaconRegion]; // Begin monitoring region and ranging beacons [_locationManager startMonitoringForRegion:appBeaconRegion]; [_locationManager startRangingBeaconsInRegion:appBeaconRegion]; }
为了澄清," _ serviceUUIDs"是NSStrings的NSArray,包含五个UUID.我正在使用Locate iBeacons进行测试,并发现要添加的最后一个区域是唯一被检测到的区域.它似乎也是唯一被监控的人.我通过检查"_locationManager.monitoredRegions"来确定这一点.
这里有许多线程说可以监控多个信标区域.有谁想过为什么它不适合我?谢谢!