【发布时间】:2015-04-02 23:21:44
【问题描述】:
我正在使用以下代码安排 UILocalNotification:
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.fireDate = [[NSDate date] dateByAddingTimeInterval:60];
notification.repeatInterval = NSMinuteCalendarUnit;
notification.alertBody = [NSString stringWithFormat:@"Wurmprophylaxe für Lassy”];
notification.alertAction = @"Wurmprophylaxe";
//notification.userInfo = userInfo;
notification.timeZone = [NSTimeZone localTimeZone];
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
通知会触发,直到我终止应用程序、重新启动应用程序或通过 xcode 重新运行。简而言之,它不会持续存在。此外,即使应用程序再次运行,它也不会再次触发。应用程序是否在前台都没有关系。一旦终止,通知就会停止触发,如果我列出本地通知,它将不再存在。似乎 UILocalNotification 没有被存储。如果应用程序处于前台、后台或根本运行,则不会发送通知。
为什么在应用启动之间将其删除?
注意:如果我安排了新通知,则之前的通知也会被删除。这太奇怪了。
【问题讨论】:
标签: ios iphone uilocalnotification