【问题标题】:EKEventEditViewController changes not saved when changing calendar更改日历时未保存 EKEventEditViewController 更改
【发布时间】:2016-03-20 19:01:44
【问题描述】:

在 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 完成时,我需要做任何额外的事情吗?

【问题讨论】:

  • 我遇到了同样的问题,解决方案是重新加载显示我的事件的表。当用户单击“完成”按钮时,EKEventEditViewController 会保存更改

标签: ios eventkit ekevent ekeventstore


【解决方案1】:

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

let event = controller.event!

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-18
    • 1970-01-01
    • 2021-06-08
    • 1970-01-01
    • 2011-03-31
    • 2017-06-28
    相关资源
    最近更新 更多