[英]EKEventEditViewController changes not saved when changing calendar
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.在 EKEventEditViewController 实例上编辑事件并选择另一个日历时,事件上的日历确实会发生变化,但对标题等其他属性的更改会丢失。
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?当 eventEditViewController didCompleteWithAction 完成时,我需要做任何额外的事情吗?
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")
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.