// 代码如下,是转载别处的,别处也是转载其他地方的,就未写明出处了。发现在xcode 5.1 的模拟器上可以测试,在xcode 6 上的模拟器就出不来,浪费了我不少的时间。
UILocalNotification *notification=[[UILocalNotification alloc] init];
if (notification!=nil) {
NSLog(@">> support local notification");
NSDate *now=[NSDate new];
notification.fireDate=[now dateByAddingTimeInterval:3];
notification.timeZone=[NSTimeZone defaultTimeZone];
notification.alertBody=@"该去吃晚饭了!";
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}