Search code examples
iphoneiosekeventkit

EKEventStore can't save an event after it errors once


I just came across a bug in my program, that has me confused. I add several events to the iPhone calendar in my app. I found that when I receive a "No end date has been set." error when calling saveEvent:span:error:, all subsequent calls to saveEvent:span:error: result in the same error message. If I change the culprit object to be valid, all events save successfully. Has anybody ran into this? Or do you know why one error might cause all future calls to result in the same error?

I know that I just need to not save an event with no end date set to fix this, but I would like to know why this is happening.

Thanks.


Solution

  • I figured this out. There is a bug in the EKEvent SDK on iOS 5 that is causing this. Hopefully it will be fixed in the first update to iOS 5. Solution:startDate and endDate should be different.

    [event setStartDate:date]; [event setEndDate:[date dateByAddingTimeInterval:1.0]];