if write something in
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSLog(@"Starting point 1");
}
main.m
int main(int argc,char * argv[])
{
......
NSLog(@"Starting point 0");
}
Which one is more useful main.m or appDelegate.m one and in which scenerio.
This is an interesting article that explains the app launch sequence.
http://oleb.net/blog/2011/06/app-launch-sequence-ios/
As a resume of the article the conclusion is:
Besides application:didFinishLaunchingWithOptions:
, there are several more entry points for custom code during the launch sequence (none of which are usually needed):
Directly in main()
before UIApplicationMain()
is called.
The init method of a custom UIApplication subclass.
The initWithCoder:
or awakeFromNib methods of our application delegate if it is created from a NIB file (the default).
The +initialize
methods of our application delegate class or a custom UIApplication subclass. Any class receives an +initialize message before it is sent its first message from within the program.
Note that this sequence only happens at the actual launch of an app. If the app is already running and simply brought back from the background, none of this occurs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With