ios - didrangebeacons not called even though didDetermineState is called -
i have set of estimote beacons. when use estimote sdk, can range beacons , use it. problem is, when use ios sdk monitoring , ranging, didrangebeacons not called @ all.
i have started ranging shown below. when checked using breakpoint, function called.
- (void) locationmanager:(cllocationmanager *)manager diddeterminestate:(clregionstate)state forregion:(clregion *)region { switch (state) { case clregionstateinside: [self.beaconmanager startrangingbeaconsinregion:self.beaconregion]; nslog(@"region clregionstateinside");
please make sure have gone through following checklist:
you have entered nslocationalwaysusagedescription in info.plist
your property self.beaconregion clbeacon region who's uuid matches uuid looking detect.
your device iphone 4s or newer, on ios 7 or higher, , has bluetooth turned on
i change code this:
- (void)locationmanager:(cllocationmanager *)manager diddeterminestate:(clregionstate)state forregion:(nonnull clregion *)region { clbeaconregion *beaconregion = (clbeaconregion *)region; if (beaconregion.major && beaconregion.minor) { } else { switch (state) { case clregionstateunknown: // handle case when bluetooth off. break; case clregionstateinside: nslog(@"inside %@", region); if (![self.locationmanager.rangedregions containsobject:beaconregion]) { [self.locationmanager startrangingbeaconsinregion:[[clbeaconregion alloc] initwithproximityuuid:beaconregion.proximityuuid identifier:beaconregion.proximityuuid.uuidstring]]; } break; case clregionstateoutside: nslog(@"outside %@", region); break; } } }
you need range on uuid, because pick beacons match uuid regardless of major , minor. note should attempt start ranging if not ranging avoid function call
Comments
Post a Comment