Prevent Save On Exit Dialog When Exiting Cocoa Document Application

Hi I have a document-based Cocoa application that I created that allows you to open individual views and interact with the webview component. However, when you ever talked to him, and then go in to close the application, a message appears:

"Do you want to save the changes made to the document" Untitled "?" Your changes will be lost if you do not save them. "

I want to say that when my application is closed, this message does not appear. I do not need automatic savings or saving options. How to prevent the display of this message and disable it?

Thank you in advance for your help and support.

Sam

+4
source share
1 answer

Recently, I had the same desire to prevent a save dialog from appearing. What I did is put the following method in my own document class that inherits NSDocument

-(BOOL)isDocumentEdited { return NO; } 
+4
source

Source: https://habr.com/ru/post/1340532/


All Articles