Piero
Piero

Reputation: 9273

UILocalNotification sometimes don't notify me

in my app i schedule some UILocalNotification every time the app is opened, but happen that sometimes the uilocalnotification is not fired and don't notify me,and when happen they don't fired anymore, to fix it i have to reinstall the app on the iPhone, so i'm explain me well, there is a period of time that the notification work and then one day the dont' work anymore and to fix it i have to reinstall it again, so to investigate i have create this method that it's called when the app did become active:

-(void)checkNotification {

for (UILocalNotification *someNotification in [[UIApplication sharedApplication] scheduledLocalNotifications]) {

    NSLog(@"%@",someNotification.alertBody);
    NSLog(@"%@",someNotification.fireDate);
}
}

and i see that all notification are scheduled and also the date, this is an example:

2012-11-25 18:36:36.532 TestApp[672:907] This is a notification.
2012-11-25 18:36:37.482 TestApp[672:907] 2012-11-27 10:00:00 +0000

so i can't understand why i don't receive notification...any help?

Edit: i create a notification in this way:

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = myNewDate;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = @"This is a notification.";
localNotification.soundName = @"smallBell.mp3";
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

Upvotes: 2

Views: 558

Answers (1)

K S
K S

Reputation: 212

You may or may not get the alert message. It depends on whether your app is running and in which state, e.g. active in the foreground, active in the background, or not running at all.

Please see this article for clarification - http://www.thekspace.com/home/component/content/article/62-uilocalnotification-demystified.html

Upvotes: 0

Related Questions