0
我得到了以下其中包含我localNotification代码:我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年7月28日15:39:48.684 JuneChecklist [2271: 907]计划通知{消防日=星期日,2013 7月28日,十五点40分33秒莫斯科标准时间,时区=欧洲/莫斯科(GMT + 04:00)偏移14400,重复间隔= 0,重复计数为UILocalNotificationInfiniteRepeatCount ,未来火日期=星期天,2013 7月28日15时40分33秒莫斯科标准时间,用户信息= { 项目Id = 0; }}为0的itemId
但它不显示(我试图在iPhone和模拟器启动应用程序)。我不知道为什么它的NSLog显示fireDate完美,但没有通知时,我等待的时间。
任何意见,将不胜感激。
现在感谢您的工作。这段代码来自教程,我想知道。 –