How to accept / decline an EKEvent invitation?

I would like to allow my users to accept / decline a meeting request in my application.

I think I need to update the EKParticipantStatus somehow, but it seems like it's impossible to update.

Apple Docs: Event Kit cannot add participants to an event or change participant information

In this question, https://stackoverflow.com/a/166269/2126122/2126122, someone suggested bringing a native EventKitUI, which I tried like this:

class CalendarViewController: UIViewController, EKEventViewDelegate { // ..... let eventController = EKEventViewController() guard let eventWithIdentifier = MeetingsFetcher.eventStoreClass.event(withIdentifier: meeting.UUID) else { return nil } eventController.delegate = self eventController.event = eventWithIdentifier eventController.allowsEditing = true eventController.allowsCalendarPreview = true let navCon = UINavigationController(rootViewController: eventController) // customizing the toolbar where the accept/maybe/decline buttons appear navCon.toolbar.isTranslucent = false navCon.toolbar.tintColor = .blueGreen navCon.toolbar.backgroundColor = .coolWhite10 // customizing the nav bar where the OK button appears navCon.navigationBar.callinAppearence() present(navCon, animated: true, completion: nil) // ..... // view gets dismissed, so it does detects the action, but no effect func eventViewController(_ controller: EKEventViewController, didCompleteWith action: EKEventViewAction) { controller.dismiss(animated: true, completion: nil) } 

The native interface shows a good one, but the buttons do not affect your own calendar.

enter image description here

Am I missing something or is it just not possible? Why would they let them interact with these buttons if nothing could be saved?

Thanks!

PD: I have these permissions in the info.plist file:

  • Privacy - Calendar Usage Description
  • Privacy - Contact Us Description
  • Privacy - Reminders Description of Use

UPDATE:

Please note that EKEventEditViewController is not what I am looking for . This screen will not allow me to accept or reject the event, it will only allow me to edit the details.

enter image description here

+5
ios swift ekeventstore ekevent
source share
1 answer

To allow the user to create, edit, or delete events, use the EKEventEditViewDelegate protocol.

 let eventController = EKEventViewController() guard let eventWithIdentifier = MeetingsFetcher.eventStoreClass.event(withIdentifier: meeting.UUID) else { return nil } eventController.delegate = self eventController.event = eventWithIdentifier eventController.editViewDelegate = self ... 

CalendarViewController class must conform to the EKEventEditViewDelegate protocol and must implement the eventEditViewController method to reject the modal view controller, as shown below:

 func eventEditViewController(_ controller: EKEventEditViewController, didCompleteWith action: EKEventEditViewAction) { switch (action) { case EKEventEditViewActionCanceled: case EKEventEditViewActionSaved: ... } } 
0
source share

All Articles