Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

GorillaPaws

macrumors 6502a
Original poster
Oct 26, 2003
932
8
Richmond, VA
I'm wondering if there's a resource where you can see exactly what happens when your app launches. I have a rough idea about several of the big steps (applicationDidFinnishLaunching, awakeFromNib etc.), but I would love to find an article/reference that goes literally step-by-step through the process of all the initial setup in a standard cocoa app.

The reason I started thinking about this is I've been reading "Cocoa Design Patterns" which is quite excellent. In the notifications chapter I came across the line:

Every thread in a Cocoa application has a default notification queue

It made me realize that there must be dozens of other objects that Apple is creating for me that I have know idea exist, and it would be interesting to see exactly what gets created when in the timeline. Does anyone know of a resource that documents this process?
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
The simplest method to finding out what is being run below your application code is to just get the debugger out and step into some Cocoa functions. Eventually you'll get down to the C level stuff and then into Assembly.

Frankly I was amazed when I compared some C programs with a test Objective-C program and the amount of crap that gets run behind the scenes.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
The first, and likely only, thing you do in your main function in a Cocoa app is call NSApplicationMain:
http://developer.apple.com/mac/libr...nce.html#//apple_ref/c/func/NSApplicationMain

From there, the most "interesting" piece is loading of the main nib. This page has some information about what happens when you do this:
http://developer.apple.com/mac/libr...bs.html#//apple_ref/doc/uid/10000051i-CH4-SW8

Stepping through things, watching calls, etc. will certainly be of value/interest but i thought it might be of value to read the documents that detail the process so you have some of the high-level knowledge about the design as well as the low-level knowledge of the actual calls that go on.

-Lee
 

GorillaPaws

macrumors 6502a
Original poster
Oct 26, 2003
932
8
Richmond, VA
Thanks for your replies. I was hoping there'd be more info/easier to access than using dtrace or the debugger. I also found this article which didn't have all the detail I was hoping for but was helpful as a general overview. Hopefully someone finding this thread in a search will find it useful.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.