tags:

views:

66

answers:

3

Which method is called first when an iPhone application loads?

+3  A: 

main(), like any Objective-C program, but it's not a method, it's a free function. You can look at it to see what happens next.

Lou Franco
+2  A: 

It depends. If you're writing a "valid", "normal", to-be-sold-in-the-AppStore in Objective-C application, then the first usable function will be one of the following UIApplicationDelegate's methods:

application:didFinishLaunchingWithOptions:
applicationDidBecomeActive:

or:

applicationDidFinishLaunching:
applicationDidBecomeActive:
application:handleOpenURL:

It will depend on what methods are implemented in your delegate class and if you want to receive messages (for instance, to respond to PUSH messages, or to "pass arguments" to your application)

Anyway, you should check the UIApplicationDelegate documentation.

rolando
I'll up-vote just because I am betting the user is looking for this as the answer but, truly, it is in the `main()`
thyrgle
I agree -- this is probably what he meant to ask.
Jeffrey Berthiaume
A: 

C++ initializers and +load methods. Here be dragons.

tc.