我得到了以下代码,其中包含我的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]预定通知{fire date =воскресенье,28июля2013г。,15:40:33Московскоестандартноевремя,time zone = Europe / Moscow(GMT +04:00)偏移14400,重复间隔= 0,重复计数= UILocalNotificationInfiniteRepeatCount,下一个开火日期=воскресенье,28июля2013г。,15:40:33Московскоестандартноевремя,user info = { ItemId = 0; 对于itemId 0
但它没有显示(我尝试在iPhone和模拟器上启动应用程序)。我想知道为什么它在NSLog中完美地显示了fireDate,但是当我等待那个时间时没有通知。
任何建议都将受到赞赏。
答案 0 :(得分:1)
但是[[UIApplication sharedApplication] scheduleLocalNotification:localNotification]在哪里??