Beacon show it's present or ranging even if, Beacon Battery is removed, what to do, to remove this bug?

血红的双手。 提交于 2019-12-13 02:26:24

问题


For StartMonitoring iBeacon my code is

-(void)startMonitoringForRegionWithUUID:(NSString*)UUID
{
    CLBeaconRegion *beaconRegion= [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:UUID] identifier:UUID];
    beaconRegion.notifyOnEntry = YES;
    beaconRegion.notifyOnExit = YES;
    beaconRegion.notifyEntryStateOnDisplay=YES;
    //[self stopMonitoringForRegionWithUUID:UUID];
    [self.locationManager startUpdatingLocation];
    [self.locationManager startMonitoringForRegion:beaconRegion];
    [self.locationManager startRangingBeaconsInRegion:beaconRegion];
}

-(void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region
{
   NSLog(@"Number Of Beacons=%d",beacons.count); // show count for removed cell beacon too. there is no any other beacon with same UUID.
}

Above mentioned delegate methods show, false beacon. Even if, beacon battery is removed from beacon. Beacons array having present of those beacon. It happens when I run iPhone or iPad for almost 4-5 hours in beacon region. After restarting device,when didRangeBeacon callback happens it works fine. My question is, Why restarting does wonder? And what to do so I can avoid getting wrong beacon in callback method didRangeBeacons?

Note:- i am using Kontak iBeacon.

来源:https://stackoverflow.com/questions/28164303/beacon-show-its-present-or-ranging-even-if-beacon-battery-is-removed-what-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!