I'm trying to show multiple notifications, however I'm getting only 1.
I have 2 beacons, so if I switch on the app with both of them in range, I get only one notification. However if I start with only 1 beacon I get that one notification, and as soon as I switch on the second beacon I get the new notification as well.
I'm not sure why it's not showing both the notifications initially. I've tried using NSLog to check, but it shows that it works for both of them, but in real shows only one notification.
if (isPresent==NO) {
[visitedBeaconsArrayMajor addObject:currentBeacon.major];
NSLog(@"Add major:%@",currentBeacon.major);
NSLog(@"numberOfObjectsinArray %d",[ visitedBeaconsArrayMajor count]);
NSLog(@"retrieve");
int count = [visitedBeaconsArrayMajor count];
NSLog(@"inserted value %@",[visitedBeaconsArrayMajor objectAtIndex:count - 1]);
NSLog(@"Show notification for major:%@",currentBeacon.major);
UILocalNotification *notification = [UILocalNotification new];
notification.alertBody = @"Enter region notification";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
This is the log:
Processing current beacon: 0 of 1
Add major:3888
numberOfObjectsinArray 1
retrieve
inserted value 3888
Show notification for major:3888
Processing current beacon: 1 of 1
Add major:6754
numberOfObjectsinArray 2
retrieve
inserted value 6754
Show notification for major:6754