WebView stays empty on iPad but not iPhone on iOS Simulator - ios

I have developed an app for the iPhone. Now I want to support the iPad as well, so I have checked the necessary checkboxes in Xcode ("Devices" - "Universal").
When I start my app in the simulator, the default ViewController is opened and a web page is loaded. The default view controller consists of a web view, that fills the entire screen. The page loads fine on every iPhone simulator, but the screen stays empty on every iPad simulator.
Because the pages are loaded on the iPhones, I don't think it is a constraint problem.
I have also unchecked the property "Application requires iPhone environment" in the info.plist file, but this doesn't change anything.
The web view is used to authenticate with a web site, so I can not check any other view controllers.
Did I miss something?

<key>UIMainStoryboardFile~ipad</key>
<string>Main_iPad</string> // storyboard name
Add this two line in your project's plist. To open plist file search .plist file. Right Click on it. Select open As source code and past above code.

Related

Launch Screen issues

When I first started to create my app, I thought that using launch screens would be a good idea, so I added the LaunchScreen.storyboard file and created a view controller meant to be the launch screen.
Now, however, I would like to remove this launch screen now. I have tried to delete the view controller and the file itself, which does not work, as the launch screen view controller still appears somehow. I have tried this answer, but nothing changed. I tried another answer(can't remember the link) which told me to delete a key-value pair in the project info. After doing that, the launch screen is gone, but a black screen replaces it, and the app is not full screen anymore on iPhone 8. There are black bars on the top and bottom of the screen.
My question is: how can I remove the launch screen completely without any side effects?
Xcode 9, Swift 4
Using a Launch Screen
It’s best to use an Xcode storyboard for your launch screen, but you can provide a set of static images if necessary.
Including static images will increase the size of your binary because you must include all resolutions (see below) otherwise you will see "black screen & the app is not full screen".
Starting April 2018, all new iOS apps submitted to the App Store must be built with the iOS 11 SDK. All new apps for iPhone, including universal apps, must support the Super Retina display of iPhone X.
https://developer.apple.com/ios/submit/
So, you would be best off replacing the launch screen with a really simple view of your application (with no data).
Take at the Human Interface Guidelines for more information: https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/launch-screen/
To quote:
Design a launch screen that’s nearly identical to the first screen of your app.
Avoid including text on your launch screen.
Downplay launch
Don’t advertise.
You can do this by using the menu bar:
File >
New >
File
Once you have created your new LaunchScreen.storyboard you need to ensure it's the one assigned to the application. You can do this either through the project file explorer or through the application plist.
Using Static Images
If you are really committed to avoid using a storyboard then you can migrate to using launch images inside an asset catalog by pressing the button above the launch screen storyboard.
By migrating to launch screen images you will be required to provide all variants of screen sizes otherwise you will not support devices such as the iPhone X.
You might be required to delete the LaunchScreen.storyboard and delete the references in the project explorer / plist.
Final notes
You may be required to delete Derived Data to remove any cached version of the launch screen storyboard.

Splash screen not visible for iPad, only a black screen gets shown

I have an universal app. The splash screen loads fine for iPhone but the same is not visible on the iPad. Instead a black screen appears in its place. I have gone through the questions posted in this regard and have followed the steps but to no avail. I am using asset catalog in my project. Storyboards have not been used. The names and dimensions of the images used are as follows:
1. Default-Landscape.png (1024x768)
2. Default-Landscape#2x.png (2048x1536)
3. Default-Portrait.png (768x1024)
4. Default-Portrait#2x.png (1536x2048)
5. Default-568h.png (640x1136)
6. Default.png (320x480)
7. Default#2x.png (640x960)
Please let me know if there is anything wrong with the dimensions I am using. The options I have selected for the Attributes Inspector for the Launch image are given in the image below:
Following is the setting for Launch image:
I added the same launch images to a sample app and the launch screen showed up perfectly on iPad.
EDIT:
As per the suggestion of #iphonemaclover, the problem was solved using "You should also remove any other key suffixed with (iPad) or ~ipad." There was a key UILaunchImages~ipad in the plist which I removed. Now the launch screen is properly visible.
Please delete your derived data and clean the your project.
Also reset your simmulater if you running over it.
Hope it will help.
Also check you have selected Universal App in your target setting.
EDIT
You should probably be using an Asset Catalogue for your launch images, which might be what Xcode is expecting. You can see what Xcode is expecting in the General tab for your target:
MORE Suggestion
Q: Why does my app launch to a black screen on iPad?
A: Apps that have been designed only for iPhone may launch to a blank screen when run on an iPad. This is caused by the presence of an empty iPad specific storyboard in the app bundle as well as an iPad specific UIMainStoryboardFile key in the app's Information Property List (Info.plist) file. Both are automatically created by the various Xcode template projects if the Universal option is selected.
...
In Xcode
Look for a file named MainStoryboard_iPad.storyboard in the file navigator. If this file is present, remove it from your project.
In In your app's Information Property List
Look for a key named Main storyboard file base name (iPad) or UIMainStoryboardFile~ipad. If this key is present, remove it. You should also remove any other key suffixed with (iPad) or ~ipad.
Finally, test your app on an iPad or in the iPad simulator and verify that it behaves as expected.
You should add your launch image to your asset catalogue, and make sure the setting shown is configured correctly.
If you don't have one already, you can add an asset catalogue by going to File > New > File, the look under the Resource tab.
Probably not related to most people's problems but I would like to add another possible issue. I had the same problem with my project. I could see my iPad images in X-Code but what I missed was that the title underneath was "unassigned" and not "iPad Portrait" (this was probably because it was a boilerplate React Native project that was initially configured only for iPhone).
After making my app universal, I needed to recreate my LaunchImage set which then had designated placeholders for iPad. I re-added all my images, assigned the new Launch Image set, clean, build and it was fixed. Hopefully it saves someone else some time.
If you're not loading an image in your slash screen do you get the white view? If you're not getting, then your view is not loaded. That is why you're getting a black screen.

Xcode Main.storyboard not showing what appears in the iOS simulator

I am working on a project with other teammates so we have be storing our project on the cloud as a zip file. After unzipping the file, Xcode does not display the main.storyboard correctly; won't show buttons, labels, images, etc. However, when built using the simulator, all of these display correctly. In Xcode I can access them and change them but am unable to delete or move them through the main.storyboard. Any ideas or suggestions to fix this inconvenience?
I think this is because the view controller is locked to prevent editing. Try unlocking it by
Select Identity Inspector of view and set Lock to Nothing

Converted Universal App doesn't show the iPad Interface

At the moment I'm building an iPhone App.
Yesterday I tried to convert it to an Universal App.
It worked, but it just shows me the tab bar, but nothing else.
I've created some Web Views and a Table View, but the iPad Simulator didn't show anything, only the tab bar.
The iPhone Simulator works great, I can see all the labels, web views etc...
I've created one Storyboard for iPhone and one for iPad.
I don't know why the iPad Simulator doesn't display anything.
Hope you can help me.
Regards
Check that you have changed the storyboard name in you target general settings, as shown in the picture below.
Use the right name for you app. Check also that the info.plist file for your project has been correctly updated:
(the second entry is for the iPad).
If that is ok, try and make a clean and rebuild.

iphone to ipad conversion: some storyboard options missing

I'm converting an iphone app to an ipad app. I've changed the project's build target from "iphone" to "ipad" and the app compiles, builds, runs and displays the way I want it to.
However, I've noticed that some parts of Storyboard still believe this is an iphone app. For example, when I try to build a segue, it only offers me the "push" "modal" and "custom" options. A newly created ipad project also offers the "popover" and "replace" options.
Similarly, this converted app does not offer me the possibility of a Split View Controller.
So is there a setting or some way to get this "iphone" -> "ipad" app to have the full ipad storyboard options without restarting the project and copying everything over?
I had a similar problem to this awhile back. I fixed it by clicking on my main project on the navigation panel. If you go to summary and look under the iOS Application Development you will see a spot that asks which devices your app is targeted to. Make sure this is switched to universal
Next create an iPad storyboard under File > new > File... > User Interface > Storyboard > set Device Family to iPad (It sounds like you already did this though). Make sure you call it something different then your iPhone storyboard.
Lastly go back to your project settings and scroll down to the iPad Development Info you will see a drop down titled Main Storyboard. Make sure that is set to your newly created iPad storyboard.
If this still is not working for you the Standford ItunesU iOS course has a lecture on converting iPhone applications to universal ones.

Resources