我正在尝试使用 EventKit.framework 在 iPhone 日历中保存事件。它完美保存,但我想将警报设置为“NONE”,但默认情况下需要“30 分钟前”作为警报。我怎么解决这个问题?这是我在 iPhone 日历中保存事件的代码
if ([appDelegate.objEvent.event_alert intValue]==0) {
alarm1 = [EKAlarm alarmWithRelativeOffset:0];
}
else if ([appDelegate.objEvent.event_alert intValue]==1) {
alarm1 = [EKAlarm alarmWithRelativeOffset:-5];
}
else if ([appDelegate.objEvent.event_alert intValue]==2) {
alarm1 = [EKAlarm alarmWithRelativeOffset:-300];
}
else if ([appDelegate.objEvent.event_alert intValue]==3) {
alarm1 = [EKAlarm alarmWithRelativeOffset:-900];
}
else if ([appDelegate.objEvent.event_alert intValue]==4) {
alarm1 = [EKAlarm alarmWithRelativeOffset:-1800];
}
else if ([appDelegate.objEvent.event_alert intValue]==5) {
alarm1 = [EKAlarm alarmWithRelativeOffset:-3600];
}
else if ([appDelegate.objEvent.event_alert intValue]==6) {
alarm1 = [EKAlarm alarmWithRelativeOffset:-7200];
}
else if ([appDelegate.objEvent.event_alert intValue]==7) {
alarm1 = [EKAlarm alarmWithRelativeOffset:-86400];
}
else if ([appDelegate.objEvent.event_alert intValue]==8) {//B4 2 days
alarm1 = [EKAlarm alarmWithRelativeOffset:-172800];
}
NSMutableArray *myAlarmsArray = [[NSMutableArray alloc] init];
// [myAlarmsArray addObject:alarm1];
// event.alarms = myAlarmsArray;
// [myAlarmsArray release];
if ([appDelegate.objEvent.event_alert intValue]!=0)
{
[myAlarmsArray addObject:alarm1];
event.alarms = myAlarmsArray;
}
else
{
// [myAlarmsArray addObject:nil];
// event.alarms = nil;
}