+(NSString *)setCalendarEvent:(NSString *)title withStartDate:(NSDate *)startDate withEndDate:(NSDate *)endDate withAlarmBefore:(NSTimeInterval )alarmTime{
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = title;
event.startDate = startDate;
event.endDate = endDate;
NSMutableArray *myAlarmsArray = [[NSMutableArray alloc] init];
EKAlarm *alarm1 = [EKAlarm alarmWithRelativeOffset:-alarmTime];
[myAlarmsArray addObject:alarm1];
event.alarms = myAlarmsArray;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
NSString* eventId = [[NSString alloc] initWithFormat:@"%@", event.eventIdentifier];
return eventId;
}
每当我将日期存储在日历中时,它都不会存储实际日期。
我想存储来自 CMS的确切日期如何通过更改时区来阻止 iOS 日历。