NSDocument based Mac app - suppress strange Save Changes prompt
-
28-06-2021 - |
Question
I started out developing this Mac app from an NSDocument-based app template, thinking that a report in it should become a rich text format document.
Now, app specs have changed, the app is finished, and I don't really need the app to be NSDocument based anymore. If modifying the app to make it non-document based is trivial, that's the correct solution, of course. This being my first Mac app, I'd have to be sure I know what I'm doing if it's a matter of you know, ripping out parts and making sure all references are intact.
For some reason, just because I enter text into a textfield in a subview of the application main window, the document is regarded as changed by some process in the app.
How do I suppress or override this prompt (roughly, "The document has changed. Save changes?")?
Solution
Put this is your NSDocument subclass, such as MyDocument.m:
- (void)updateChangeCount:(NSDocumentChangeType)changeType {
//overridden to do nothing
}