私には2つの質問があります。UILocalNotification repeatInterval
私がローカルの通知を理解している場合、repeatintervalは通知を1回スケジュールすることができ、毎週または毎月または曜日の同じ間隔で繰り返されます。私は火曜日に一度発火する繰り返し間隔を得ようとしており、毎週火曜日に同じ日に再び発火するでしょう。これは、別の通知をスケジュールする必要なしに、毎週継続する必要があります。あれは正しいですか。それは起こっていないのですか?私はコードで何か間違っているか、間違っているかテストしています。
シミュレータでは、私はアプリのスケジュールをnotificaitonを実行します。私が見ている通知が現れます。その後、私はアプリを終了し、システムの日付を将来1週間に設定しますが、通知はありませんので、コンピュータのシステムクロックを変更することでこの通知をこのようにテストできます。私は各テストのために1週間待つ必要はありません。ここで
はコード
- (void) scheduleNotificationWithItem:(NSDate *)date interval:(int)frequency {
UILocalNotification *localNotif = [[UILocalNotification alloc]init];
if (localNotif == nil) {
return;
}
localNotif.fireDate = [date addTimeInterval:frequency];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.repeatCalendar = [NSCalendar currentCalendar];
localNotif.repeatInterval = kCFCalendarUnitWeekday;
localNotif.applicationIconBadgeNumber = 1;
localNotif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"%@.",nil),@"Weekly Reminder"];
localNotif.alertAction = NSLocalizedString(@"View Notification Details", nil);
localNotif.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication]scheduleLocalNotification:localNotif];
[localNotif release];
}
で、これは狂気私を運転している助けてください。 ありがとう、 ディーン
for#2は、シミュレータを実行しているもの(Macbookや他のMac [またはHackintosh])でシステムクロックを変更すると、シミュレータで動作します。私は5.1シミュレータと6.0シミュレータでこれをテストしました... – Cashew