Copied iPhone storyboard over to iPad, but iPad loading with different view controller - iphone

I recently copied everything in my iPhone storyboard over to an iPad storyboard and changed nothing. It runs perfectly on the iPhone, loading WelcomeViewController as the initial scene.
However, when I run it on the iPad, the program crashes because it tries to load MainViewController as the initial scene.
I checked on Interface Builder, and the initial scene is set to view controller WelcomeViewController. I went in the debugger and put a breakpoint in the ViewDidLoad method of WelcomeViewController, and the iPad never hits that breakpoint but the iPhone does.
This is the Identity Inspector for the view controller of my initial scene.
This is the Attributes Inspector for the view controller of my initial scene (same as above).
Why does the iPad insist on trying to load ViewController as the initial view controller?
Thanks
EDIT: When I go to Targets > iPad Deployment Info, and set the main storyboard to the MainStoryboard_iPhone instead of MainStoryboard_iPad everything works. For some reason this MainStoryboard_iPad, a literal clone of the iPhone storyboard, doesn't.

Make sure your iPad view has initial controller set to WelcomeViewController in the storyboard. It is represented by an arrow as given below.
Next make sure your iPad Deployment section in target refers to your iPad storyboard.

Related

Storyboard viewcontroller resize

i just copy and paste all the view from iPhone storyboard and paste it on iPad storyboard,everything works fine but the base view from every view controller was locked and couldn't resize.any idea on this?
the property to adjust width,height,x,y was turn to grey and unclick-able.
you need to go to your project file in xcode -> summary tab -> ipad deployment info -> main storyboard. set that to your storyboard file. it should cause all your viewcontrollers to resize to the ipad size.

Is setting the Main Interface in Xcode necessary for Apple acceptance?

My project is in Xcode 4.2, designed for iOS 4.2 and above.
I am not using a Storyboard so in the Summary, both Main Storyboard and Main Interface are blank.
Will this cause problems with my submission to Apple?
I ask because when I set the Main interface to my primary View Controller, I get this error when I compile: this class is not key value coding-compliant for the key mainTableView.'
and I don't know how to resolve it.
From the ViewController Programming Guide:
"If a main storyboard is declared in this file, then when your app launches, iOS performs the following steps:
It instantiates a window for you.
It loads the main storyboard and instantiates its initial view controller.
It assigns the new view controller to the window’s rootViewController property and then makes the window visible on the screen."
The key word being "if". Therefore I don't think it's necessary.
I have a universal app that started out as an ios3 app and was updated to universal in the past 6 months - I didn't declare any storyboard (I've not used storyboards at all yet) or Main Interface. I simply add my viewcontroller's view to the window in applicationDidFinishLaunching.
When you state that you "set the Main interface to my primary View Controller" did you mean you set the view (not the view controller)? Is this a Xib file? A View Controller won't work, it needs to be a View/Xib.

iOS iPad start landscape, push VC, popVC, view has bad positioning

I start my app in landscape for iPad. A nav controller holds my tableVC I click on a cell we push a new VC onto the stack. That works fine. The problem is, when I press the standard "back" button on the nav controller, my app gets forced into portrait and my tableVC is off of the screen. I am doing no manual positioning of views. This doesn't happen if I start the app in portrait mode.
How do I fix this abnormal behavior?
Notes: There is also a tab bar present in the app if it matters.
Upon further testing, if I load the NavController in portrait (with the first view being the table view) then switch it to landscape, then select the cell, then press back, it works fine. So the problem only happens if i start the app in landscape and never turn it to portrait.
EVERY VC has shouldAutoRotate set to return YES. I have subclassed the tab bar and done the same. I am wondering if this is a bug. Perhaps the problem lies in the fact that I took existing .XIB files and their views that were created for iPhone, then copied and pasted them, then deleted the iPhone specific views and then added iPad views.
If your subclassed TabBar Controller returns yes, and ALL of your VCs return yes for shouldAutoRotate, then the problem lies within your xib files. Though your explanation makes it sound like the VC you are pushing doesn't return yes, you've stated that it does, so it must be the xib files.
In IB, try setting the default orientation of your xib views to landscape, clean - build and run.
That may provide a clue or two.
Maybe you can create a new and simple iPad application with just a tabbarcontroller a navigation controller and 2 viewcontrollers to test if the cause is or is not the recycled iPhone .XIB files.
Also you can Command+Shift+F to search in the whole project for ": UIViewController" to double check that every VC has shouldAutoRotate set to return YES, in case you have third party code in your application that has a subclass of UIViewController on it. (the search will return a list of headers files that inherits from UIViewController).
I had had similar problems with really weird behaviors that were fixed by deleting the .XIB file and made it again.
Good luck finding the problem =)

iPad view controller loading blank on simulator, fine on ipad and simulator < 5.0

I've got an iPad app that I've been developing and testing against iOS 4.2. When I started testing on iOS 5.0, a lot of things have started working strangely.
The app starts up with a UINavigationController housing a home view screen, where the user can choose from some options before loading up the rest of the app. When the user selects the launch button, a new UIViewController is set up with the given options and then I swap the root view controller inside the navigation controller using setViewControllers:animated:
This view has a nib template that loads and then proceeds to set up other views built both programmatically and loaded from other nib subviews. On the iPad (4.0-5.0) and the simulator (<5.0) this all works great. However, on the 5.0 simulator, when I do this view swapping to go to the main app view controller, all I get is a big blank (white) screen. A view gets loaded, but it doesn't contain any of the subviews in the nib (which are tied to attributes of the file owner). The file owner is set to the view controller, the top-level view is set to the file owner 'view'. As I said, everything works everywhere but in the 5.0 simulator.
I've tried changing my init method on the view controller (originally using initWithNibName:, now just using init) and again, it works everywhere else, but not on sim5.0.
I also tried loading and swapping another view controller in it's place to make sure it wasn't a problem with setViewControllers:, but everything worked fine.
I've tried cleaning the project and physically removing the build. Nothing seems to make any difference. Anyone have any idea how to fix this?

loaded the "MainWindowController2" nib but the view outlet was not set

I saw the questions about this error.
But i believe i have a new one.
i have an application that runs on iPad and iPhone 4, but if i run it on iphone 3gs and switch to one specific tab it will crash with error
"loaded the "MainWindowController2" nib but the view outlet was not set."
How can it be that it runs on one device and dont run on other device?
Not sure why it would run on one device and not the other but that error is usually produced when the view outlet on the controller is not hooked up in Interface Builder. Load up the MainWindowController2 in the IB and make sure that the view outlet is hooked up correctly