0
votes

Good day to you,

I have an iPhone app which I want to run on an iPad. However I'm experiencing different behaviour when running on an iPad (sim or device) as opposed to running it on the iPhone. NOTE: I do not want to make it a universal app, it is set as an iPhone app.

The initial view controller is a tabBarController - see below (taken from the iPhone storyboard - there is no iPad storyboard):

enter image description here

I have some code in appDidFinishLaunchingWithOptions that gives me a handle on the tabBarController which I use later on. When running on the iPhone, the line of code I use (shown at line 53 below) works fine and returns me the tabBarController object, the intial view controller.

enter image description here

My problem: When running on the iPad (simulator or device), self.window.rootViewController in the app delegate returns me the "Alert Central View Controller" object - which you can see from the storyboard snippet above, is further down the view hierarchy, and is definitely not the initial view controller.

What is happening here? I would have thought that because it's running in iPhone mode, and not iPad mode, there should be no change to the hierarchy of views when running on the iPad. Obviously I'm wrong!

Should I be trying to get at the initial view controller in a different way?

Can someone teach me what the difference is, please?

Thanks!

1
what do you mean by blank object? nil or UIViewController?David.Chu.ca
I've just updated the question with a better description of what was returned, thanks :)Stretch

1 Answers

2
votes

Check your Info.plist file for the Main storyboard file base name key and make sure there is only an entry for the iPhone with the correct storyboard filename. I encountered this same issue and discovered that the plist had two storyboard entries. After deleting the additional key my app no longer crashed. Also checkout UIStoryboard Class Reference.