Black screen instead of launch image on iPad - iphone

I am developing an iPhone app for iOS 6.1 and 7 (using Xcode 5). I have a problem with iPad launch images.
On iPad 7.0 and 7.0.2, the launch image is not showing up(in 6.1 works!): I get black screen while app is loading.
I don't face this issue with iPhone 6.1 and 7.0.2, although I set all launch images required for iPad and iPad retina (landscape and portrait) and I use Asset Catalog.
What am I missing?

Recently I faced same issue with my App designed only for iPhone , I had the problem where the launch images would not appear in iPad (On iPad ios >= 7.0.x the launch image is not showing up I get black screen while app is loading (in iPad ios < 7.0.x it works fine )).
I don't face this issue of launch image with iPhone worked fine in all iOS versions.
Solution: Is to update to asset catalog to manage your app's images and target only iOS 6 and Prior.
Steps :
Step 1:
Step 2:
Step 3: on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images.
Uncheck the iOS 7 check boxes for iPhone, Now you should be able to see the launch images for iPad on iOS >= 7.0.x.

If you have the same situation like mine, that's solution:
My app is landscape only, iOs7 only, ipad\iphone (XCode 5).
Problem: black launch on iphone (and simulator), normal launch in ipad.
Solution: go to Images.xcassets - Launch Images - select it. Uncheck at right all "iOs7 and later" boxes. Check "iOs6 and prior" boxes and fill empty spaces with images.
Strange, but works.

Per Apple's documentation (link); an empty iPad specific storyboard may be the answer. I've also seen issues where the initial view controller is not set within a storyboard causes a black screen. A variant of this issue might be an incorrect setting in the app plist.
Technical Q&A QA1780
Why does my app launch to a black screen on iPad?
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 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.

I requested Apple support and it turned out that it's a bug. They asked me to report it and I did. Here is the report id : 15340531.
Now it's up to them.

Using LaunchScreen.storyboard
I was having a similar problem until I found the following settings in the General Project Settings.
Set your Main Interface to your main storyboard file. Mine is called Main.storyboard.
Set your Launch Screen File to your launch screen storyboard file. Mine is called LaunchScreen.storyboard. (This is what I had originally ommited.)
After that the launch screen loaded first and then the main story board loaded shortly later.

Try set the image again make sure that resolution of the splash screen is according to the iOS 7 guidelines

I know this sounds stupid. I've had bugs like that when I saved a file in psd-format with a jpg extension. Just 1 wrong click while saving your launch image.

After having tried several solutions found here, I suspected that the iPhone was trying to launch in Landscape orientation, and thus not finding any corresponding launch image. Indeed, the simulator was starting in Landscape for a reason I was not understanding.
Finally, after reading Apple documentation, I found that it's probably the order of keys in "Supported interface orientations" of the info.plist file that was not adequate. The Portrait was the last item. When it's the first item, the app launch in Portrait mode and find the image.

Remove previously installed app from the device or simulator, Then relaunch the app after clean.

I had the problem where the launch images would no appear in iPhone (3.5 or 4 inch) in iOS 7, but the iPad had no problems with iOS 7.
Long story short is I disabled the asset catalog for the launch images only. So I'm adding the launch images the old fashioned way. That seems to have solved the problem.
I will have to do more testing tomorrow, but it seems the problem is solved (at least in my case).

in Xcode 5 , make sure thay you add all needed images mentioned in your app target.

I am assuming that when you are using Asset Catalog, you have ensured that you have the Images.xcassets target membership added correctly. I am mentioning this since if you have multiple targets, looks like you have to add them manually (and you have not provided any screenshots so one can be sure).
Now that you have not really provided a screenshot of the "LaunchImage" overview of Images.xcassets folder in your project, I can only guess the probable reason. Looking at the fact that the launch images work fine for iPhone (6.1 & 7.0.2 and iPad (6.1) and do not work only for iPad (7.0 and upwards), I think you could perhaps look at as to whether the dimension of the images for iPad Portrait and iPad Landscape are proper for iOS7. Specifically, you should see your launch images and not empty rectangles as seen in the attached pic-
This can happen due to the fact that you still have the iPad launch images for iOS7 created excluding the status bar area. Prior to iOS7, the iPad launch images were created to exclude the status bar area, but it's a must on iOS7 that all the launch images must include the status bar area. Please go through the section "Things Every App Must Do" in Apple iOS7 UI transition Guide (https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf).
The following screenshot should explain what I am talking about-
e.g. you can see that iPad Landscape Retina image dimension for iOS6.1 and previous is 2048x1496 (excluding 40 px for status bar) but the dimension for the same image for iOS7.0 and upwards is expected to be 2048x1536 (including the 40px for status bar). So, if you have not changed your images accordingly, you will see black screen for images on iPad 7.0 and upwards. On iPhones, you will not face this issue since iPhone launch images always cover the status bar, be it iOS6.0 and iOS7.0- so the new UI requirement is already met for iPhone launch images.

I found this answer which worked for our app (iPhone only, but used on iPad): https://stackoverflow.com/a/19448782/1258419
To summarize from that answer:
How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices.

I encountered a similar problem in landscape, my iOS 7 launch image wasn’t displayed while the iOS 6 did. Mine was the iPhone Retina 3.5” launch image.
Since I have another app in portrait that didn’t share this issue, I did 2 things:
In info.plist, under “Supported interface orientations”, I added the
2 portrait modes as well, and put them before the landscape, like
this:
Item 0: Portrait (top home button)
Item 1: Portrait (bottom home button)
Item 2: Landscape (right home button)
Item 3: Landscape (left home button)
Implemented this method in the View Controller:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
This works with or without the Asset Catalog.

This is an update for iOS 8.
I got the same problem when I tried to add a LaunchImage to my iOS 8 app.
Apple enables developers to use a xib, whose default name is LaunchScreen.xib, to render the launch view as of iOS 8. I believe developers can use either LaunchImage or LaunchScreen.xib. Unfortunately, I couldn't find any document describing how to deal with LaunchImage after LaunchScreen.xib was introduced. I always got a black screen when I tried to use LaunchImage as the launch view.
My solution is:
Don't think about LaunchImage. Use LaunchScreen.xib. (You have to keep an empty LaunchImage in your Asset Catalog though. I believe it's a bug.)
Drag an UIImageView to the xib and make the UIImageView full screen. Remember to take the size classes and constraints into account.
Set an image whose resolution is enough for iPhone 6 plus to the UIImageView.

Check your all images and see if it is properly placed in the Asset and properly named and sized.
Also check which orientations your are allowing and accordingly add images to the asset.

I had the same problem.
I had to make a workaround: used the Default image for all iOS versions and DELETED the UILaunchImageFile key from info.plist.
I cannot use different launch images for iOS 7 and previous versions, so, I had to use the same "artistic" image for all, instead an image that mimic the first view of the app (which Apple recommends and I prefer), but at least I do not get the black screen anymore.
It looks like the UILaunchImageFile key that allows to use differents launch images for iOS 7 and previous versions is not working properly for Retina iPad in iOS 7.
WARNING: I am still testing the app, so I don't know if could be some side effects.

I also faced the similar issue but its solution was simple (in my case).
All I did was following -
1.Add a new file (if you have not added it) Launchscreen.storyboard
2.Get a UIViewController, mark it as Is Initial View Controller then add a UIImageView in it and set a picture which you want to display during launch of your app. Make sure you give this UIImageView required constraint.
3.Go to Project->General->App Icons and Launch images and select Launchscreen.storyboard as Launch Screen File (There will be a dropdown for it).

Because of iOS 13 and later, app launch different than earlier versions.
Get the solution from below URL.
https://stackoverflow.com/a/59913274/883505

I simply forgot to call super.loadView() in my view controller...
override func loadView() {
super.loadView()
}

Related

iPhone landscape-only no launch image for iOS7 R4 image asset

I'm fairly certain this is a bug, but in case anyone has found a way around this, let me know.
I've set up an asset catalog in Xcode-5 of launch images. If I set an iOS 7 R4 image it is only used if my app supports portrait orientation. My app is landscape-right only and I do not see the launch image.
The iOS 5,6 images work just fine, and the R4 iOS 5,6 image will actually load "correctly" if I leave out the iOS 7 R4 image.
Has anyone been able to get this to work?
Update
I've found that I can get iOS 7 landscape images to appear, but only if I remove the default (iOS6) images, which doesn't really help me. If you edit the info.plist and change the image orientation to "Landscape (right home button)" (for example), then provide a horizontal image, it will actually show it on iOS 7 at launch. Unfortunately, if you include an iOS 6 image, it shows that instead. Also, you will not see the iOS 7 image listed in the "General" tab of your target if the orientation is anything other than Portrait. This is with Xcode 5.0 and iOS 7.0.2.
My Solution is Don't use asset catalogs and provide
Default.png (320x480)
Default#2x.png (640x960)
Default-568h#2x.png (640x1136)
as bundle in project and iOS will automatically found them(Apple doesn't have landscape launch image for iPhone or iPod, so we need to provide rotated 90 degree of landscape image)
You may need
Default-Landscape#2x~ipad.png
Default-Landscape~ipad.png
if you do iPad too.
Don't forget to delete fixed launch images name in your Project-Info.plist if you have
The solution that we have found is to update the asset catalog and target only iOS 6 and Prior.
How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices.
Not enough rep to add a comment, so I'll post an answer to clarify a couple of things.
I wouldn't recommend remudada's answer as it is a workaround that may not be compatible for future releases, and, it does contain that black border problem. Generally warning are there for a reason.
NAlexN's answer works as it addresses the problem - iOS is looking for a portrait splash screen, but if the portrait button is off - problem. So, keep the portrait button on and add to your viewcontroller the following:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
I ran into the same problem with my landscape - only application, and here is how I solved it:
Navigate to General tab in your project settings, iPhone Device Orientation section and deselect checkboxes beside Landscape Left and Landscape Right, and select Portrait orientation.
Run the app on iPhone 3.5 or 4 iOS 7 simulator with this settings. The app could crash if you have hardcoded Landscape masks somewhere in your app's view controllers, but it does not matter.
Put checkmarks back for Landscape Left and Landscape Right, but leave Portrait orientation allowed as well. That is you should allow Portrait and both Landscape orientations for iPhone.
I solved it this way:
Go to the project settings and select "Don't use Asset Catalog" in the launch images section. Now you can add the launch images the traditional way. You can still use the asset catalog for the app icons and other images
In XCode 6.1 For IOS 8...Use Launch Image Source as Launch Image...and Replace Launch Screen File from LaunchScreen.Xib to Blank..
Hope this will help........

Black bars showing when running app on iOS 7 (4 inch retina display)

We have an iPod app built with base SDK as 5.1.
App has a tabBarController with three tabs and each tab has a UIViewController to load a different view.
The app works fine for iOS 6.1 and iOS 7 (3.5 inch display) simulator and device but when we run the app on
iOS 7 (4 inch display simulator) or device we are getting black bars at the top and bottom of the view screen in all three tabs.
If anyone can suggest reason for this or some feasible solution to this problem, it would be really helpful for us.
Thanks
First thing is that you must add the required default image for 4 inch screen display. Check Properly in you project have image with name Default-568h#2x.png (640 × 1136 pixels)
This Default-568h#2x.png is Necessary for Support app in 4 inch Screen display
Ones you add this image in to you working Project, Remove old Build from device or Simulatore, clear Project and re build and check Hope you issue will solve.
Edit:-
After fix the black Bar issue you can check the device like my answer Give here check this:-
Detect device type
you have two choice if you can't use AutoLayout
First
Create two xib with same class one for 3.5 inch screen and one for 4 inch screen set using macro with checking which screen appear.
Second
Set Self.view frame using macro with checking which screen appear.
There are also other methods you can use for set self.view frame as using window frame or UIScreen
My problem was I accidentally deleted the value found here:
I added back LaunchScreen, and made sure there was a LaunchScreen.xib. Maybe it will help some others.
Ive had the same problem - black bars at the top and bottom. It was simply solved by setting the drop down in "App Icons and Launch Images" to Main_iPhone:
App Icons and Launch Images Screen Shot
I was facing same problem . I just added launch image and it worked for me.
XCode->Click on Project File -> Select Target-> App Icons and Launch Images -> Add launch image source
This worked!
Pay attention to Step#5 and Step#6 below:
1.In xcode, Click on the Project file in Project Navigator
2.Click General tab
3.Type "Main_iPhone" in the Launch Screen File field
4.Save
5.Remove the app from device or simulator
6.Then in Xcode go to Product Menu and then select Clean
7.Build again

View doesn't take up full screen on iPad

Simply that. I'm working on an iPhone (iOS) game that loads without using .xib files. Window and view is created programmatically. It automatically detects resolution and retina display and adjusts accordingly.
However when run on and iPad (only have the simulator for iPad), it shows up in a mini window that same size as the iPhone resolution, with a little 2x button in the bottom-right corner. I want it to load fullscreen with full resolution (larger res than the phone). Everything will scale accordingly so it would look the same as on the phone, and look just as crisp.
Why does this happen? Why doesn't the window automatically take up the fullscreen like it does on iPhone?
After much searching, I've found this template: https://github.com/ryanscott/rcloudlib/blob/master/Samples/clean_universal_app_template.zip
which loads properly for me on both iPhone and iPad.
Looking at the code, however, it does nothing differant than what I am doing. All it does is check which device is being used, and loads the appropriate app delegate, which in this case contain the exact same code, albeit for background color. This is clearly aimed towards those who want to have a different view load on iPhone vs. iPad, while avoiding using nibs. I want the SAME view across all devices, so I have no need to use multiple delegates or the like.
How can I force the app delegate to use the fullscreen regardless of device?
In your Xcode project file, find your target, go to the Summary tab and make sure that Devices is set to Universal under iOS Application Target
Yup! In Xcode 6 the "Devices" option is now called "Deployment Target" and is located here:

How to make my iphone app work on an iPad?

It is my understanding (i have seen it) that some apps can be opened and viewed in an iPad. Although, the iPad keeps the screen small, or pixelated if doubled the screen size.
I am attempting to do the same thing with my app, however when I attempt to run it on an iPad it crashes with the error
'Could not find a storyboard named 'MainStoryboard_iPad'
This is obvious, as I do no have a storyboard for the iPad, but currently I don't want one. I just want the iPad to run the app as an iPhone app in a smaller version. So my question is, how do I stop it from looking for the iPad storyboard? Its my understanding I must adjust something in the plist.info but I don't know how to access that in xcode. its my understanding you select the project in the navigator then select 'info' but I don't see any information that people say should be in the plist.info.
Thanks
You seem to have made your application universal. You want to set your "devices" to iPhone. This can be done on the target summary page (No need to interact with your .plist directly).
Only target iPhone platform, and do not call any iPad interface objects in your code. You should look in your Main xib file to make sure there are no references to an iPad interface object.
iPhone only apps should natively run in double-pixel mode. In order to resolve the pixelated / grainy issue you see, use #2x (for iPhone) size images. This will reduce the pixelation you see, but will still contain some.
Ok, I found the final issue. After editing the summary to 'iPhone' I also had to go into the Info tab and change the line that says
'Main storyboard file base name (iPad) to MainStoryboard_iPhone. It was currently set to MainStoryboard_iPad. That second step fixed the issue.
Thanks guys!

iPhone 5 not displaying app properly

I am testing some old apps on the iPhone 5 simulator. Most of the apps display properly, that is the display centered, maintaining the original iPhone aspect with blank space on the top and bottom.
One of my apps acts differently. It stretches the launch image (an old 2:3 aspect launch image) to the full height top to bottom of the iPhone 5 simulator. Then it snaps the app to the top of the window, as opposed to centering it.
I suspected this had something to do with auto-layout, but as far as I can tell, being new to the concept, it is disabled. As I checked in the file inspector and "use auto layout" is unselected.
Any thoughts? Thanks for reading!
Removing Default-568h#2x.png from the project should solve the problem. It seems like several people have been having a problem with Xcode auto-creating this launch image.
From my experience it looks like when you open a project in XCode 4.5 it automatically adds a flag to each view saying "Autoresize subviews" and by default this is set to true. When I disable this flag for all my views, they no longer stretch. Interestingly though, I don't get the letterboxing in the simulator, instead a get a white band at the bottom.
I ended up manually setting up the views for the iPhone 5 because I could not locate or fix the issue. Setting up the views specifically for the iPhone 5 was relatively easy, but frustrating to not know why it was necessary in this case.
I detected the iPhone 5 using the code below found in this stack overflow answer: How to detect iPhone 5 (widescreen devices)?
#define IS_IPHONE_5 ( [ [ UIScreen mainScreen ] bounds ].size.height > 500)
if (IS_IPHONE_5 ) {
//set up views
}
Remove the Default-568h#2x.png from the project, and also, you must manually remove the app from the simulator before running it again from Xcode. It looks like ios6 saves some kind of a flag for the installed apps that makes it think it should stretch it.
Simply removing the Default-568h#2x.png did not solve my problem.
First I deleted this file, than I drag a 640x1136 image to the "Launch images - Retina (4-inch)" of "iPhone Deployment Info" section in Xcode.
In iOS 7 Sdk if your are not added launch image in your project you need to
Add launch image (640 X 1136 and 640 X 960)into your project, Then go to General Tab and set both launch image (Retina, Retina 4 inch) then remove app from simulator and run again should solve the problem