How to create a document-based application that cannot create a new document?

I have a document-based application designed to process existing documents, not create new documents.

How can I prevent an application from creating a new blank document at startup by opening it from Finder?

+2
source share
2 answers

There is an NSApplication delegate protocol method that you can implement.

 - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender {
    return NO;
}

Here's the documentation

+9
source

Depending on what you are doing specifically, you can override newDocument: or applicationOpenUntitledFile: or else stop the user from calling him through the File-> New menu.

, ShouldOpenUntitledFile: , .

+1

All Articles