I have an application where I have a main.m
that returns NSApplicationMain(argc, (const char **) argv);
.
I want to run code on -appl
Louis' answer is concise and spot-on. However, if the concept of delegate methods is new to you, you'd do well to check out the relevent documenation.
The applicationDidFinishLaunching: method of the NSApplication delegate will be called when the app has finished loading. Many of the project templates setup a delegate. If you are using one just add the appropriate method to it.
If your project does not have an app delegate set up you will need to do that yourself. First, make a new class to act as your delegate (you can use an exiting one if there is something logically appropriate). Now make sure that class is instantiated in your MainMenu.nib. Finally, hook the delegate property of the "File's Owner" object to the instantiate delegate in IB.