Iphone 我的本地通知不是';行不通

Iphone 我的本地通知不是';行不通,iphone,objective-c,uilocalnotification,Iphone,Objective C,Uilocalnotification,我得到了以下代码,其中包含我的localNotification: -(void)scheduleNotification{ if (self.shouldRemind && [self.dueDate compare:[NSDate date]] != NSOrderedAscending){ UILocalNotification *localNotification = [UILocalNotification new]; loc

我得到了以下代码,其中包含我的localNotification:

-(void)scheduleNotification{

    if (self.shouldRemind && [self.dueDate compare:[NSDate date]] != NSOrderedAscending){

        UILocalNotification *localNotification = [UILocalNotification new];
        localNotification.fireDate = self.dueDate;
        localNotification.timeZone = [NSTimeZone defaultTimeZone];
        localNotification.alertBody = self.text;
        localNotification.soundName = UILocalNotificationDefaultSoundName;
        localNotification.userInfo = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.itemId] forKey:@"ItemId"];

        NSLog(@"Scheduled notification %@ for itemId %d", localNotification, self.itemId);

    }
}
我在NSLog中的输出如下所示:

2013-07-28 15:39:48.684 JuneChecklist[2271:907]预定通知{火灾日期=欧洲/莫斯科(GMT+04:00)偏移量14400,重复间隔=0,重复计数=UILocalNotificationInfiniteRepeatCount,下一次火灾日期=13,28,13,15:40:33,用户信息={ ItemId=0; }}对于itemId 0

但它并没有显示出来(我试过在iPhone和模拟器上启动应用程序)。我想知道为什么它在NSLog中完美地显示了fireDate,但在我等待那个时间时并没有通知


任何建议都将不胜感激。

但是[[UIApplication sharedApplication]scheduleLocalNotification:localNotification]在哪里

现在感谢你的工作。这段代码来自教程,我想知道为什么作者忘记了这么简单的事情。