Possible Duplicate:
Is there any reason to modify the main.m file in your iOS applications?
I am new in the iphone applications development and I want to know why we don’t actively use the main.m file in the iphone programming. I saw in the many books the following usage:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
iOS programs do start from a
main()function, usually found in a file calledmain.m. You might have trouble locating this file, because it’s normally in a group calledOther Sources, not theClassesgroup where most code ends up.In most iOS programs,
main()does little more than callUIApplicationMain(), which creates the application object and runs the main event loop.I don’t know the precise details of why it’s done like that, but I’ll hazard a guess that a lot of framework-dependent stuff will break if you try to call it before the event loop gets going.