Reputation: 54251
I am currently trying to debug a problem with an iPhone app. When I run it in Xcode main
is called, but not - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
. This leads me to an essential question which should help me resolve this problem, but also understand more the startup sequence of an iPhone/ iPad application. So, can anyone explain in a succinct manner what happens when main is called in an iPhone or iPad app?
Thanks!
Upvotes: 2
Views: 216
Reputation: 5935
Note also that if you create a new project in Xcode with one of the templates, Xcode will build a very nice main method that will definitely call didFinishLaunchWithOptions for you, which you can analyze and follow Xcode's lead.
Upvotes: 0
Reputation: 2118
When main is called,
UIKIT_EXTERN int UIApplicationMain(int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName);
is called.
Here is what Apple has to say for this method.
If nil is specified for principalClassName, the value for NSPrincipalClass from the Info.plist is used. If there is no NSPrincipalClass key specified, the UIApplication class is used. The delegate class will be instantiated using init.
You can check these entries in the main.h or the info.plist.
Upvotes: 1