1

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
Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • Try having a different alertBody for each notification – Paulw11 May 24 '14 at 00:37
  • What do you mean "switch on"? Are you using AirLocate or something? – rob5408 May 24 '14 at 01:00
  • FYI, you will only see the notification only when the app is inactive/on background. See: http://stackoverflow.com/questions/11220237/uilocalnotification-not-firing-when-the-app-is-in-working-mode – Ricky May 24 '14 at 02:44

0 Answers0