我想在2秒内从ios中的UILocalNotification fireDate检查一个条件

时间:2014-08-13 08:22:16

标签: ios objective-c xcode5 uilocalnotification

我将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秒。

1 个答案:

答案 0 :(得分:0)

我认为不可能。您可以安排另一个通知并处理它是否得到响应。由于您的应用可能无法运行,因此没有别的办法。如果您能够支付推送通知,请查找silent push.

相关问题