在我的应用程序中,我在CoreLocation中使用Beacon Region Monitoring.
该应用将2个proximityUUID设置为区域(它们具有不同的ID),
并开始如下所示.
该应用将2个proximityUUID设置为区域(它们具有不同的ID),
并开始如下所示.
#pragma mark - CLLocationManagerDelegate (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { [self.locationManager requestStateForRegion:(CLBeaconRegion *)region]; } - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { [self.locationManager stopRangingBeaconsInRegion:(CLBeaconRegion *)region]; } - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region{ for(CLBeacon* b in beacons){ //output only prevIoUs beacon if it's before regionout to prevIoUs region NSLog(@"%@",b); } } - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { //error } - (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region{ if(state == CLRegionStateInside){ if ([region isMemberOfClass:[CLBeaconRegion class]] && [CLLocationManager isRangingAvailable]){ [self.locationManager startRangingBeaconsInRegion:(CLBeaconRegion *)region]; } } }
它适用于iOS 8和iOS 9,但在iOS 10中不起作用.
[在iOS 8 / iOS 9中]
1.broadcast beacon1 2.[app]didRangeBeacons (beacon1) 3.stop beacon1 and broadcast beacon2 4.[app]didRangeBeacons (beacon2)
[iOS 10]
1.broadcast beacon1 2.[app]didRangeBeacons (beacon1) 3.stop beacon1 and broadcast beacon2 4.[app]didRangeBeacons (**beacon1**)
这是iOS 10的错误吗?