View Controller's viewDidLoad method finishing before applicationDidFinishLaunching

Posted by mwt on Stack Overflow See other posts from Stack Overflow or by mwt
Published on 2010-03-12T22:28:49Z Indexed on 2010/03/12 23:17 UTC
Read the original article Hit count: 476

I'm creating a fairly complex iPhone app using Core Data. Up until now, things have been working fine. As the app has been getting more complex, however, a new problem has come up: the first view controller is finishing its viewDidLoad method before the AppDelegate gets even halfway through its applicationDidFinishLaunching method.

The view controller is not the root, which is a tab bar controller. The VC in question is the one for the default selected tab on the tab bar. It's getting instantiated by IB.

Nothing like this has occurred before in my experience, and it's throwing off the important initialization I'm doing in the AppDelegate (getting objects from Core Data and preparing them for use) . Furthermore, it's intermittent -- sometimes the delegate does finish first.

Has anyone else noticed a difficulty like this? Any sample code that deals with such an issue?

I suppose that the answer is to make the VC load the data that the AppDelegate is getting ready only when the AppDelegate sends a message that it's ready. I'm a bit concerned that this is adding something that will just end up biting me in the butt later on.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk