Search code examples
objective-cxcodemacosautomatic-ref-countingapplication-lifecycle

Xcode 5 document template Apps OS X: Where to do the Apps lifecycle


I am new to programming for Mac (not iOS but OS X) and so have run into a problem. The template providing a document based application doesn't come with an appDelegate class. Only class provided and used is the NSDocument subclass.

My Problem: Where do I put the - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender (or equivalent) method I need in order to call a NSAlert? If I place it into my NSDocument subclass, it never gets called.

Thanks for any help.


Solution

  • Solved it! Just had to implement my own AppDelegate class (however I didn't know how to do this. I just looked in a test app (non document base) how it goes).

    Also, I looked here: X-Code Interface Builder Not showing App Delegate Object