Search code examples
objective-ccocoansdocument

Enabling Save for an NSDocument


I am using an NSDocumentController subclass to do some custom stuff when I create my NSDocuments. The strange thing is that when the document is created, the Save option in the menu is disabled. The problem is that I use the save function to save something manually out from the document so it's decoupled from the main NSDocument saving procedure. Normally I use [self updateChangeCount: NSChangeDone] when I make changes in the document, but that doesn't seem to have any effect on enabling the Save menu item when the document is created.

I use [NSDocument saveToURL] when it's first created, so that might be what's disabling save afterwards. Is there a way for me to force it to be saveable again?


Solution

  • Have you explored using either of these?

    NSDocument

    - (BOOL)isDocumentEdited
    

    NSDocumentController

    - (BOOL)hasEditedDocuments