user625384
user625384

Reputation: 51

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

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

Upvotes: 5

Views: 696

Answers (1)

Andrius
Andrius

Reputation: 433

Recently I had the exact same wish to prevent the save dialog from showing up. What I did is put the following method in my custom document class that inherits NSDocument

-(BOOL)isDocumentEdited {
    return NO;
}

Upvotes: 5

Related Questions