アプリ デリゲート (Apple ボイラー プレート コード) で定義されたマネージド オブジェクト コンテキストがあります。
セカンダリウィンドウが閉じて次のコードが表示されたときに保存をトリガーしようとしています:
NSLog(@"close and save");
HEFTAppDelegate *appDelegate = (HEFTAppDelegate *)[[NSApplication sharedApplication] delegate];
NSError *error = nil;
if (![appDelegate.managedObjectContext commitEditing]) {
NSLog(@"%@:%@ unable to commit editing before saving", [self class], NSStringFromSelector(_cmd));
}
if (![appDelegate.managedObjectContext save:&error]) {
[[NSApplication sharedApplication] presentError:error];
}
これにより、データが保存されることはないようです。
どこが間違っていますか?