EKEvent Update

I am trying to make some changes to an EKEvent object in my calendar. I have an event, for example, from 1 to 2 in the morning. When I set the allDay property to YES, this event will be correctly changed and will be displayed throughout the entire day section of the calendar. But this does not work the other way around. I set the start and end time correctly, and the allDay property is NO, but the event remains as it is. Time changes are not updated. That's what I'm doing:

EKEvent *event = [self.eventStore eventWithIdentifier:MY_IDENTIFIER];

NSDate *start = [NSDate date]; // Get the current time
NSDate *end = [start addTimeInterval:3600]; // Add one hour

event.startDate = start;
event.endDate = end;
event.allDay = NO;

// Set some other event properties like title, location....

NSError *error;
[self.eventStore saveEvent:event span:EKSpanThisEvent error:&error]; // Save changes and make them appear in the calendar

All changes work, and I get no errors - only changing allDay YES to NO does not work. I looked at the Apple documentation and only found information that the start and end dates of the event can be set. I am not sure if this means that allDay events are enabled and can be set too.

?

+3
3

allDayEvent = NO ? . , .

0

Google Apps. , , ( , iCloud), EKEvent.allDay = YES .

0

, . . . . .

0

Source: https://habr.com/ru/post/1753172/


All Articles