- (IBAction)addReminder: (id)sender
{
NSDate *date = self.datePicker.date;
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate: date];
NSDate *newDate = [date dateByAddingTimeInterval: interval];
NSLog(@"Setting a reminder for %@", newDate);
UILocalNotification *note = [[UILocalNotification alloc] init];
note.alertBody = @"Hypontize me!";
note.fireDate = newDate;
[[UIApplication sharedApplication] scheduleLocalNotification: note];
}
我之前以为是dataPicker时区的问题,加8仍然不行,然后用本地时间+30s仍然不弹出本地通知,求大神帮忙
{
NSDate *date = self.datePicker.date;
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate: date];
NSDate *newDate = [date dateByAddingTimeInterval: interval];
NSLog(@"Setting a reminder for %@", newDate);
UILocalNotification *note = [[UILocalNotification alloc] init];
note.alertBody = @"Hypontize me!";
note.fireDate = newDate;
[[UIApplication sharedApplication] scheduleLocalNotification: note];
}
我之前以为是dataPicker时区的问题,加8仍然不行,然后用本地时间+30s仍然不弹出本地通知,求大神帮忙