Hi,
I have to monitor only 20 estimote beacons when app in background .The major and minor values of beacons which are to monitored will come from server.
i am writing code like this
for (int beaconCount=0; beaconCount <[BeaconArray count]; beaconCount++)
{
//Start Monitoring beacons
CLBeaconMajorValue major = [[[BeaconArray objectAtIndex:beaconCount] objectForKey:@"major"] integerValue];
CLBeaconMinorValue minor = [[[BeaconArray objectAtIndex:beaconCount] objectForKey:@"minor"] integerValue];
NSUUID *serverUUID = [[NSUUID alloc] initWithUUIDString:[[BeaconArray objectAtIndex:beaconCount] objectForKey:@"uUID"]];
NSString *strIdentifier = [NSString stringWithFormat:@"EstimoteRegion%d",beaconCount];
// ESTBeaconRegion *beaconRegion = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTEPROXIMITYUUID major:major minor:minor identifier:strIdentifier];
ESTBeaconRegion *beaconRegion = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTEPROXIMITYUUID major:major minor:minor identifier:strIdentifier];
beaconRegion.notifyEntryStateOnDisplay = YES;
beaconRegion.notifyOnEntry=YES;
beaconRegion.notifyOnExit=YES;
ESTBeaconManager *beaconManager = [[ESTBeaconManager alloc] init];
beaconManager.delegate = self;
[beaconManager startMonitoringForRegion:beaconRegion];
}
The beacons are not getting monitored with this code.But if i try
int major1 = 3597;
int minor1 = 4483;
self.beaconRegion1 = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:major1 minor:minor1 identifier:@"Skyblue"];
self.beaconRegion1.notifyEntryStateOnDisplay = YES;
self.beaconRegion1.notifyOnEntry=YES;
self.beaconRegion1.notifyOnExit=YES;
self.beaconManager1 = [[ESTBeaconManager alloc] init];
self.beaconManager1.delegate = self;
[self.beaconManager1 startMonitoringForRegion:self.beaconRegion1];
int major2 = 48239;
int minor2 = 41497;
self.beaconRegion2 = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:major2 minor:minor2 identifier:@"Lightgreen"];
self.beaconRegion2.notifyEntryStateOnDisplay = YES;
self.beaconRegion2.notifyOnEntry=YES;
self.beaconRegion2.notifyOnExit=YES;
self.beaconManager2 = [[ESTBeaconManager alloc] init];
self.beaconManager2.delegate = self;
[self.beaconManager2 startMonitoringForRegion:self.beaconRegion2];
int major3 = 18112;
int minor3 = 50393;
self.beaconRegion3 = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:major3 minor:minor3 identifier:@"Violet"];
self.beaconRegion3.notifyEntryStateOnDisplay = YES;
self.beaconRegion3.notifyOnEntry=YES;
self.beaconRegion3.notifyOnExit=YES;
self.beaconManager3 = [[ESTBeaconManager alloc] init];
self.beaconManager3.delegate = self;
[self.beaconManager3 startMonitoringForRegion:self.beaconRegion3];
Like this the beacons are getting detected.Can any one tell me whats wrong with for loop code.