views:

66

answers:

0

Hello,

I'm trying to make some changes to an EKEvent object in my calendar. I have an event for example from 1 a.m to 2 a.m. When I set the allDay property to YES, this event is changed correctly and appears in the all day section of the calendar. But it's not working the other way round. I'm setting the start and end time correctly and the allDay property to NO, but the event remains as it is. The time changes aren't updated. Here'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

The changes work all and I don't get any errors - only the change allDay YES to NO doesn't work. I took a look on Apple's documentation and only found the information that the event's start and end dates can be set. I'm not sure if this means that allDay events are included and can be set, too.

Has anyone a solution for this?

Thank you.

Dominik