我将UILocalnotification设置为特定时间,它完美运行。但是我希望在2秒之前检查一个条件来解雇。我创建了这样的通知,
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = pickerDate;
localNotification.alertBody = @"See today's recommendations";
localNotification.alertAction = @"Reminder";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.repeatInterval = NSDayCalendarUnit;
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
例如,我将时间设置为下午2:00:10。我的场景是,我想在设定时间2秒之前检查一个条件,比如下午2:00:08。那么,如何检查此时间不到2秒。
答案 0 :(得分:0)
我认为不可能。您可以安排另一个通知并处理它是否得到响应。由于您的应用可能无法运行,因此没有别的办法。如果您能够支付推送通知,请查找silent push.