2016-03-20 26 views
1

EKEventEditViewControllerのインスタンスでイベントを編集して別のカレンダーを選択すると、イベントのカレンダーは変更されますが、タイトルなどの他の属性の変更は失われます。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が完了したときに、余分な何かをする必要がありますか?

+0

私は同じ問題を抱えていました。解決策は、イベントを表示していたテーブルをリロードすることでした。 EKEventEditViewControllerは、ユーザーが「完了」ボタンをクリックしたときに変更を保存します – jessi

答えて

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") 
} 
関連する問題