我想知道当用户通过触摸通知本身但通过快速应用切换或主屏幕图标启动应用时,UINotification何时消失。
我已经检查了[[UIApplication sharedApplication] scheduledLocalNotifications]
但是在通知发出后,这个数组是空的。
答案 0 :(得分:0)
一旦本地通知即将在通知中心显示,它将不会在[[UIApplication sharedApplication] scheduledLocalNotifications]
中显示。
如果您的应用处于有效状态且会调用didreceivelocalnotification
,但当您的应用未处于有效状态时,它将显示在通知中心。
所以它会保留在通知中心,直到你清除它。
如果你想让你可以使用didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
方法在appdelegate方法中检查它。
UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotif)
{
NSLog(@"lcoal:%@",[localNotif userInfo]);
UIAlertView *al=[[UIAlertView alloc]initWithTitle:@"Challenge gehaald!" message:@"Gefeliciteerd, je hebt deze bonus challenge succesvol afgerond." delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[al show];
}