下面的代码包含了我的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 6月检查表2271:907预定通知{fire date =воскресенье,28июля2013г.,15:40:33Московскоестандартноевремя,时区=欧洲/莫斯科(UILocalNotificationInfiniteRepeatCount)偏移14400,重复间隔= 0,重复计数= UILocalNotificationInfiniteRepeatCount,下一次火灾日期=воскресенье,28июля2013г.,15:40:33Московскоестандартноевремя,ItemId 0用户信息{ itemId = 0;}
但它没有显示(我尝试在iPhone和模拟器上启动应用程序)。我想知道为什么它在NSLog中完美地显示了NSLog,但是当我等待的时候没有通知。
如有任何建议,将不胜感激。
发布于 2013-07-28 11:51:12
但[ scheduleLocalNotification:localNotification];?UIApplication sharedApplication ]在哪里?
https://stackoverflow.com/questions/17907870
复制相似问题