I am configuring my UILocalNotification to use the default timezone i.e. the one in settings of the iPhone i.e. the time that appears on the iPhone’s clock however it keeps using greenwich time. Any ideas?
//This method gets called every time the user changes the event date:
- (void)rescheduleNotification {
[[UIApplication sharedApplication] cancelAllLocalNotifications];
//create new one using interval
UILocalNotification *localNotification = [[UILocalNotification alloc]init];
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.fireDate = [self.currentSetting.lessonStartDate dateWithOffsetMinutes:[self.currentSetting.lessonRemindMinutes intValue]];
NSLog(@"locationNotificated scheduled for %@", localNotification.fireDate);
localNotification.repeatInterval = NSWeekCalendarUnit;
localNotification.alertAction = nil;
localNotification.alertBody = @"due to begin shortly";
localNotification.hasAction = YES;
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[localNotification release];
}
All
NSDateobjects when they are printen will use GMT.So you
NSLogstatement will always display something with the+0000timezone.Example:
if you set the date to
15:00and your time zone is+0500then when you print the date it will say:10:00since the offset is+0500