0

こんにちは、奇妙な種類の問題に直面しています。実際には、毎日の通知 (1 日 1 回のみ) を午前 8:00 にスケジュールしたいと考えています。以下は、毎日の通知をスケジュールするための私のコードです。

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"HH:mm"];
NSDate *date = [[NSDate alloc] init];
date = [formatter dateFromString:@"08:00"];
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = date;
localNotification.timeZone=[NSTimeZone defaultTimeZone];
localNotification.alertBody = @"You just received a local notification";
localNotification.alertAction = @"View Details";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[formatter release];
[date release];

私の問題は、2 つのローカル通知を受け取ることです。1 つは午前 8:00 に、もう 1 つは午前 10:00 に。午前 10 時に通知を受け取る理由。私はそれを午前8時のみにスケジュールしています。UILocalNotification ライブラリには、ほとんどの Apple デバイスで他にも奇妙な問題やバグがあることを知っています。私のコードに間違いがあるのか​​ 、それともUILocalNotificationライブラリの奇妙な動作なのかを確認したいだけです。UILocalNotification に関して多くの開発者から報告されている問題の解決に Apple が取り組んでいない理由がわかりません。

注: Xcode 4.6 と iOS 6.1 を使用しています

4

1 に答える 1

1

これは、回答を得るための最良のリンクです。

于 2013-11-04T07:55:41.773 に答える