How to execute code when starting an application in a document based application

I have a document based Cocoa app.

When the application starts, I want it to execute some code that will create a dictionary that should be accessible to any document in the application, but I only need the dictionary created when the application starts, not when a new document is opened. I currently have one controller class that is instantiated both when the application starts and when new documents are opened.

How to do it?

+2


source to share


1 answer


Use this:

- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
    //Your code here
}

      

in the application section.



It will also work for iPhone.

Edited according to Peter's comment

+5


source







All Articles