Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iBeacon major and minor value inside didEnterRegion

I'm trying to access the major and minor values for the closest beacon within the didEnterRegion delegate. However, when printing the values to the console they return null

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {

    if ([region isKindOfClass:[CLBeaconRegion class]]) {

        CLBeaconRegion *beaconRegion = (CLBeaconRegion *)region;

        int major = [beaconRegion.major intValue];
        int minor = [beaconRegion.minor intValue];

        NSLog(@" Major %@ Minor %@", beaconRegion.major, beaconRegion.minor);

        }
}
like image 301
user3626407 Avatar asked Feb 13 '23 00:02

user3626407


1 Answers

The region monitoring callback you have implemented will not tell you the individual identifiers of the beacons you detect. If you want to get the identifiers for individual beacons detected, you have to use the beacon ranging APIs as @Larme says in his comment. The callback for ranging includes a second parameter that is an array of all beacons seen.

like image 174
davidgyoung Avatar answered Feb 16 '23 03:02

davidgyoung