There isn't a keyWindow
at that time in the application lifecycle, so the reason there's no rootViewController
to get on the keyWindow
is because keyWindow
is nil
. But the app delegate has a property for your window
, so you can just get self.window.rootViewController
.
However, if you always have the same root view controller, you could probably do at least some of what you want to do (maybe all of it) in your root view controller's viewDidLoad
method. This generally should only ever be called once, because with iOS 6 and later your offscreen view controllers' views are never unloaded.