There are quite a few questions on why local notification is not firing properly here and there,also there are several questions on why local notification is not firing when the application is in background state which I have also gone through them.
But to my surprise I haven't found any notification post related to foreground state or in active state,i.e. in my app I am facing this strange issue,i.e. local notification fires when the app enters background mode and it doesn't fire when the app is in active state or in foreground mode,to my surprise again,even after fire date set for notification is expired,immediately after entering background,the notification fires.
EDIT
Also another issue I am facing is the alert is not firing,i.e. the alert action we write in didReceive local notification method,here is the implementation code:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
application.applicationIconBadgeNumber = 0;
NSString *reminderText = [notification.userInfo objectForKey:addViewController.textField.text];
[self.addViewController showReminder:reminderText];
}
And here is that showReminder method which is present in another controller i.e.:
//Notification alert
- (void)showReminder:(NSString *)text
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reminder" message:text delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 10, 40, 40)];
UIImage *image= [UIImage imageNamed:@"icon@2x.png"];
[imageView setImage:image];
[alertView addSubview:imageView];
[imageView release];
[alertView show];
[alertView release];
}
Sorry if this issue doesn't require a question or post in stackoverflow.
Any one please post your suggestions and any help is gladly appreciated!
Thanks all in advance :)