UILocalNotification iOS仅显示一次

时间:2014-05-24 00:09:29

标签: ios objective-c core-location uilocalnotification

我试图显示多个通知,但我只获得1.

我有2个信标,所以如果我在两个范围内打开应用程序,我只会收到一个通知。但是,如果我只从一个信标开始,我会得到一个通知,并且一旦我打开第二个信标,我也会得到新的通知。

我不确定为什么它最初没有同时显示这两个通知。我已经尝试过使用NSLog进行检查,但它表明它适用于它们,但实际上只显示了一个通知。

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];

    }

这是日志:

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

0 个答案:

没有答案
相关问题