I am currently in the process of trying to teach myself Cocoa development. Toward this end, I purchased a mostly-excellent book, Cocoa Recipes for Mac OS X: Vermont Reci
The answer marked correct (@Bavarious'answer) fails to work on document-based apps because documents often load before any applicationWillFinishLaunching:
is called. After reading the helpful clues in @Graham Perks answer, I tried a few different approaches and this seems to work reliably:
@implementation AppDelegate
- (id)init
{
self = [super init];
if (self) {
MyDocumentController *dc = [[MyDocumentController alloc] init];
if (dc) {};
}
return self;
}
Note Obviously (if not already created) you'll need to create an AppDelegate yourself first and link it in your MainMenu.XIB.