gpt4 book ai didi

ios - 更改日历时未保存 EKEventEditViewController 更改

转载 作者:行者123 更新时间:2023-11-29 12:03:05 24 4
gpt4 key购买 nike

当在 EKEventEditViewController 实例上编辑事件并选择另一个日历时,事件上的日历会发生变化,但对其他属性(如标题)的更改会丢失。

如果我不选择其他日历,更改将按预期保留。

这是我加载编辑器时的代码

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)
}

当 eventEditViewController didCompleteWithAction 完成时,我是否需要做任何额外的事情?

最佳答案

在您的回调中,您没有保存事件。尝试在回调中保存您的事件,看看是否能解决问题。类似这样的东西:

let event = controller.event!

do {
try eventStore.saveEvent(event, span: .ThisEvent, commit: true)
} catch {
print("Could not update the event store with supplied changes")
}

关于ios - 更改日历时未保存 EKEventEditViewController 更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36118153/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com