[修正] (ちょっと) イベントの終了時にアラームを鳴らすことができないようです。イベントがカレンダーの x 日数にまたがって表示され、終了予定になったときにアラームで通知されるようにしたかったのです。それは不可能のようです。イベントが始まる前にのみアラームを設定できます。愚かなリンゴ:(
新しいイベントを追加するときにアラームを保存できないようです。コードは次のとおりです...イベントが発生したときにアラームを鳴らしたいのですが、終日オプションが台無しになっているのではないかと思いましたが、それでも保存されません。
これがコードです...
EKEventStore *store = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:store];
event.title = title;
event.startDate = [global main].Entry.WithdrawalDate;
event.endDate = [global main].Entry.WithdrawalDate;
//event.allDay = YES;
event.availability = EKEventAvailabilityFree;
event.location = [global main].Holding.Name;
event.notes = [self compileNotes];
//Tried settings the array and adding to it, neither works
//NSArray *arrAlarm = [NSArray arrayWithObject:[EKAlarm alarmWithAbsoluteDate:[global main].Entry.WithdrawalDate]];
//event.alarms= arrAlarm;
EKAlarm * alarm = [EKAlarm alarmWithAbsoluteDate:[global main].Entry.WithdrawalDate];
[event addAlarm:alarm];
[event setCalendar:[store defaultCalendarForNewEvents]];
NSError *err;
saved = [store saveEvent:event span:EKSpanThisEvent commit:YES error:&err];