AppDelegate.m
- (void)applicationWillEnterForeground:(UIApplication *)application
{
application.applicationIconBadgeNumber = 0;
}
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
application.applicationIconBadgeNumber = 0;
NSString *reminderText = [notification.userInfo objectForKey:kRemindMeNotificationDataKey];
[self.settings showReminderAlert:reminderText];
NSLog(@"Application REcieved Local Notification");
}
ViewController.m
-(void)showReminderAlert:(NSString *)text{
NSLog(@"Alert Called");
UIAlertView *reminderAlert = [[UIAlertView alloc]initWithTitle:@"Alert" message:text delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[reminderAlert show];
[reminderAlert release];
}
我希望我的应用程序在用户重新进入application.app
didReceiveLocalNotification
正在调用但未调用 Alert 方法时显示警报。