Reputation: 12559
When editing an event on an instance of EKEventEditViewController and selecting another calendar, the calendar on the event does change, but the changes to other attributes like the title get lost.
If I don't select another calendar the changes are persisted as expected.
This is my code when loading up the editor
let editorVC = EKEventEditViewController()
eventKitEditorViewController = editorVC // eventKitEditorViewController is a class variable
editorVC.event = ekEvent // ekEvent is the supplied event to edit
editorVC.modalPresentationStyle = .Popover
editorVC.eventStore = OP1EventKitManager.sharedInstance.eventStore // the store is on a singleton object
editorVC.editViewDelegate = self
rootVC.presentViewController(editorVC, animated: true, completion: nil)
/// DELEGATE METHOD
func eventEditViewController(controller: EKEventEditViewController, didCompleteWithAction action: EKEventEditViewAction) {
print(action)
controller.dismissViewControllerAnimated(true, completion: nil)
}
Do I need to do anything extra when the eventEditViewController didCompleteWithAction is completed?
Upvotes: 1
Views: 650
Reputation: 5303
In your callback, you are not saving the event. try saving your event in the callback and see if that fixes the problem. something similar to this:
let event = controller.event!
do {
try eventStore.saveEvent(event, span: .ThisEvent, commit: true)
} catch {
print("Could not update the event store with supplied changes")
}
Upvotes: 1