1
+(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日历。

4

0 回答 0