Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

cocoa

dialog

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

like image 611
user625384 Avatar asked Feb 20 '11 16:02

user625384


1 Answers

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;
}
like image 96
Andrius Avatar answered Oct 16 '22 19:10

Andrius