I'm struggling with deleting a single event of a recurring event series.
In this case I set up a weekly recurring event and tried to delete one event with the following code:
let event = self.eventStore.event(withIdentifier: eventID)
try! self.eventStore.remove(event, span: EKSpan.thisEvent)
The result was that the first event of the occurrence has been deleted (not the third occurrence I selected). Am I missing something?
All events in the recurring event series have the same identifier. Therefore, you cannot delete the desired event. One possible solution is to fetch all events from the calendar for the certain time period and find the one you need by id. For example, if you have a chain of events that occur every day from 1:00 PM to 2:00 PM, and you need to modify the one that occurs next Thursday, you should fetch all events for Thursday from 1:00 PM to 2:00 PM, and among them should be the instance of the event from your chain. Now you can delete it.