I have a CoreData / NSPersistentDoc app. It works fine.
I added a new entity to the MOM, and updated the version.
Now, when I create new instances of that Entity inside the MOC, the “Save” menu item remains disabled until/unless I create any instances of the old Entities that were already in the app.
The red dot button on titlebar correctly goes black to show that the document has changed – but OS X / NSDocument refuses to acknowledge this – it is impossible to do a Save.
Any ideas?
I found the cause / solution – it was my own bug, but this answer may help others with similar issues.
I was using Apple’s official approach for enabling the Copy/Paste menu items (by implementing validateMenuItem), and returning true/false for copy and paste at the right times.
And I was returning NSPersistentDocument’s implementation for everything else (which included Save, although I didn’t see that).
Then, when I added my new NSManagedObject, I added a sub-view, and sub-view-controller, and I delegated the validateMenuItem to this – i.e. so that it could handle it’s own copy/paste status.
…but I had no code path for “if it’s not copy paste, and it’s not handled by the child, and it’s not handled by my NSPersistenDocument subclass … then hand it to NSPersistentDocument to decide”…
…and so the Save menuitem was never being enabled.