Preventing the "Save on Exit" dialogue on exit of a Cocoa Document Application

Discussion in 'Mac Programming' started by gwelmarten, Feb 20, 2011.

  1. gwelmarten macrumors 6502

    Joined:
    Jan 17, 2011
    Location:
    England!
    #1
    Hi
    I have a Cocoa document based application that I have been building, that allows you to open seperate views and interact with a webview component. However, when ever you have interacted with it, and then go to close the application, a message comes down saying:

    "Do you want to save the changes you made in the document “Untitled”?
    "Your changes will be lost if you don’t save them."

    I wish to make it that when my application is closed, this message is not shown. I do not need any auto-saves or saving options. How do I prevent this message been shown and disable it?

    Thanks in advance for any help and support.

    Sam
     
  2. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #2
    Code:
    -(BOOL)isDocumentEdited { return NO; }
     
  3. gwelmarten thread starter macrumors 6502

    Joined:
    Jan 17, 2011
    Location:
    England!
    #3
    Hi
    Thanks very much for the code. Not completely sure which file in my XCode project to put this code. Please could you tell me? I assume it would be in MyDocument.h or MyDocument.m.

    Thanks in advance.
    Sam
     
  4. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #4
    It overrides the NSDocument method in your subclass.
     

Share This Page