UILocalNotification のストアを作成するメソッドがあります。
- (void)save:(NSString *)program at:(NSDate*)date {
NSLog(@"date to save: %@", date);
// NSLog(@"timezone: %@",[date descriptionWithLocale:[NSLocale systemLocale]]);
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
NSLog(@"date to fire: %@", date);
localNotification.fireDate = date;
NSString *s=[program stringByAppendingString:@" is now on "];
NSString *title=[s stringByAppendingString:channel];
localNotification.alertBody = title;
localNotification.alertAction = @"Show...";
//localNotification.timeZone = [NSTimeZone localTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
NSLog(@"notification to save %@",localNotification);
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
// Request to reload table view data
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadData" object:self];
// Dismiss the view controller
[self dismissViewControllerAnimated:YES completion:nil];
}
そして、私は出力として持っています:
date to save: 2013-08-29 17:00:00 +0000
date to fire: 2013-08-29 17:00:00 +0000
notification to save <UIConcreteLocalNotification: 0xc0c4240>{fire date = Thursday, August 29, 2013, 6:00:00 PM Central European Standard Time, time zone = (null), repeat interval = 0, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = Thursday, August 29, 2013, 6:00:00 PM Central European Standard Time, user info = (null)}
タイムゾーン設定のコメントを外しても、UILocalNotification は常に 1 時間ずつ増加します。なぜ、どのように ? 助けてくれてありがとう。