Ios 通知在上午12点而不是上午7点送达

Ios 通知在上午12点而不是上午7点送达,ios,objective-c,Ios,Objective C,我正试图安排在早上7点发送通知。但它会在早上12点送到。请帮帮我,我做错了什么。这是我的密码 NSString *date = @"4/14/2013 07:00"; NSDateFormatter *df = [[NSDateFormatter alloc] init]; [df setDateFormat:@"MM/dd/yyyy HH:mm"]; NSDate *thisDate = [df dateFromString:date]; UILocalNotification *local

我正试图安排在早上7点发送通知。但它会在早上12点送到。请帮帮我,我做错了什么。这是我的密码

NSString *date = @"4/14/2013 07:00";
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"MM/dd/yyyy HH:mm"];
NSDate *thisDate = [df dateFromString:date];

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = thisDate;
localNotification.timeZone = [NSTimeZone defaultTimeZone];  
localNotification.alertBody = @"This is notification";
localNotification.alertAction = @"view";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.alertLaunchImage = Nil;
self.badgeCount ++;
localNotification.applicationIconBadgeNumber = self.badgeCount;
localNotification.userInfo = Nil;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

我希望这份通知能在早上7点送达。相反,它会在凌晨12点弹出。这里出了什么问题?

我打赌
localNotification.timeZone
df.timeZone
不一样

将此项添加到日期格式化程序:

df.timeZone = [NSTimeZone defaultTimeZone];

我打赌
localNotification.timeZone
df.timeZone
不一样

将此项添加到日期格式化程序:

df.timeZone = [NSTimeZone defaultTimeZone];

确切地当我看到-5小时的差异时,这似乎是显而易见的。这不会有什么帮助
NSDateFormatter
默认为当前时区。因此,将其设置为默认时区是不可操作的。除非
defaultTimeZone
已准确地设置为
localTimeZone
之外的其他值。当我看到-5小时的差异时,这似乎是显而易见的。这不会有什么帮助
NSDateFormatter
默认为当前时区。因此,将其设置为默认时区是不可操作的。除非已将
defaultTimeZone
设置为除
localTimeZone
之外的其他值?