views:

660

answers:

1

I'm playing around with the iPad SplitView template and it was working fine before I started swapping out view objects in my RootViewController. When it was working fine, the application:didFinishLaunchingWithOptions method would be called and would setup my persistant store objects, then the RootViewController:viewDidLoad method would be called to populate my rootView with data from my store. I opened up IB and started swapping out view objects in my RootView and now the application:didFinishLaunchingWithOptions method never gets called, but the RootViewController:viewDidLoad method still does. Obviously, the app crashes because the viewDidLoad method depends on the successful execution of the didFinishLauchingWIthOptions method to setup the persistent store objects. Does anyone have any thoughts on what is causing this or how I can go about investigating what's causing this?

I'm obviously new to iPhone OS development, so I apologize if this questions is absurd in any way. Thanks so much in advance for your help!

+1  A: 

-viewDidLoad is not called from -application:didFinishLaunchingWithOptions:. They are independent. The call hierarchy could be summarized as:

  1. load app; call -application:didFinishLaunchingWithOptions:
  2. window is visible, load views of view controllers.
  3. call -viewDidLoad.
KennyTM
thanks, kenny! the question i asked is based on our agreed understanding of the call hierarchy. the call hierarchy implies that viewDidLoad gets called after didFinishLaunchingWithOptions completes. if that's the case and didFinishLaunchingWithOptions never completes (or executes at all), then why does viewDidLoad get called?
BeachRunnerJoe
@Beach: If `-application:didFinishLaunchingWithOptions:` doesn't exist, it is simply skipped. It's an optional method.
KennyTM
ok, i'll look into that. it does exist in my code, so i guess i need to figure out why it's being skipped. thanks again!
BeachRunnerJoe