2
votes

I'm using EventKit to create and remove calendar (EKEvent) events.

My code is very basic, create an EKEventStore() and add a new event (EKEvent) using save. Later in some specific scenario the event is fetched from the eventStore using event(withIdentifier:) and removed.

Everything works well until the app is restarted.

When trying to fetch an event that was saved in previous run of the app the fetch returns nil with exception:

2018-01-26 20:26:30.532019+0200 MyApplication[1029:329807] [EventKit] Error getting event with identifier 174799E7-BD04-48B6-8B54-60AC28F4224C:FF38551F-EA72-4718-8DAD-827E48078E63: Error Domain=EKCADErrorDomain Code=1010 "(null)"

Save event line:

eventStore.save(event, span: .futureEvents, commit: true)

Fetch event line:

let event = eventStore.event(withIdentifier: eventIdentifer)

Any ideas?

1
Note that my scheduled event (specifically) is a recurring event. I've tried to use calendarItemIdentifier instead, which appear to work and fetch the event after app restarted but it gets only the first event of the occurrence, not the "master" event. When removed (with .futureEvents flag) only the first event of the occurrence is removed.ox_

1 Answers

0
votes

Please ignore this question, issue resolved.