Best way to wait app Launch
I have an app that requests from the server some data on xml type. Ok, it does ok. But seems this action loads a little the app on launching.
TBXML *tbxml = nil;
tbxml = [[TBXML tbxmlWithURL:[NSURLURLWithString:@"http://www.someplace.com/test/test.xml"]] retain];
So, what i figured is make the app wait to launch completely to do this action. So, i've search for it, and 开发者_StackOverflow社区find two ways.
- applicationDidFinishLaunching;
- awakeFromNib;
I dont know if this is the correct way to do this. So, im open to suggestions.
Thanks!
First, I would suggest you to put that XML loading code in a separate thread using NSOperationQueue or NSThread so that it won't block the main thread.
applicationDidFinishLaunching
, IMHO, should be used to initialize your RootViewController, handle incoming push notifications, local notifications, etc. Use viewDidLoad
in RootViewController for your purpose.
精彩评论