iOS 14 Launch Screen storyboard doesn't display images on iOS 14 devices - xcode11

I have a fairly simple splash screen with a background image (aspect fill) and some text and stuff laid out with auto layout.
The same thing occurs building with Xcode 11.7 or Xcode 12 as long as you target an iOS 14 device or simulator.
If there is an image in the Launch Screen storyboard, the launch screen appears pure black with and none of the components appear on the screen. If I rename the image source to an invalid one, all components appear except the image.
I have tried moving the image out of the asset catalog with no luck. I have tried using the new iOS 14 splash screen info.plist options but can't replicate the design I need to, plus the docs say that storyboard launch screens will still be supported so I can't figure this out.
Anyone else seen this and had any luck fixing it? I have tried everything I can think of! The only other similar question on stack is here but is vague and could be unrelated

Here's how I was able to resolve this for others who can't use the new launch screen API due to design restrictions:
Build using Xcode 11
Convert any images used in the Launch screen to PNGs
Rename the image assets in the catalog and update the
references in the Storyboard as well (this is important!)
Clear the splash screen cache by calling this at the beginning
of didFinishLaunching (only in debug mode!):
#try {
[[NSFileManager defaultManager] removeItemAtPath:[NSHomeDirectory() stringByAppendingString:#"/Library/SplashBoard"] error:&error];
} #catch (NSException *exception) {
NSLog(#"Failed to delete launch screen cache: %#", error);
}
after that my splash screen works on iOS 14 and prior as expected.

Related

Xcode 10 UIBarButtonItem Images Vanish On Storyboard

I am using the latest version of Xcode 10 that's available in the app store. I keep losing UIBarButtonItem images in the designer. They are visible when the app is run. I can get the images back by switching the image to a different one and then switching it back again. This is what it looks like when the images are gone:
This is what it looks like when the images are visible:
If I change one image, all of the images on the screen come back. They will generally stay until I close down and reopen the app in Xcode.
They always display correctly when run on an actual device. I have tried it on multiple iPads, an iPhone, and every device simulator that I could find. This is only an issue with images on the designer.
This is how the images are set up in Xcode:
The 1X image is 24x24, the 2X image is 48x48, and the 3X image is 72x72. All images that I am using were created in Affinity Designer. They were all saved as PNG files. This is a file with the images that I'm using for the checkmark: Checkmark Files
All of the images have the following settings:
This is what the settings for the UIBarButtonItem looks like.
So far, this is just an annoyance that is happening in multiple apps that I'm working on. I'd just like to figure out why it is happening and if it is just an Xcode bug.

text height different between IB and simulator

On a test drive app, I have a basic UIViewController (QZTestViewController) loaded with its xib file with only one UILabel centered by autolayout. This controller is opened from the home controller (QZHomeViewController designed in the default storyboard).
The problem is that the height of this label is smaller that the result on the simulator. See it in XIB/Simulator comparison snapshot.
Any idea ? A small test project is available here if someone can have a look and help me before I become crazy.
PS: Note that the simulated metrics is set to iPhone 5.5-inch in the XIB file and I run the simulator iPhone 6s Plus (9.3).
From the size of the status bar items on the Simulator (and double-checking your project), I can tell that your app is being upscaled to fit the screen. This is happening because it's not properly configured to the 4.7" or 5.5" screens.
To fix that and make it load with the correct resolution, simply add a LaunchScreen storyboard to your project. Go to your project settings, select your Target and in App Icons and Launch Images select a storyboard or xib file to Launch Screen File. This will make the app compatible with the larger screens' resolutions, and your button will have the correct size as it will not be upscaled :)

iPhone 6(s) plus not scaling new application correctly for some users

I have a brand new Swift 2.0 XCode 7 Storyboard based application.
Target is set to 9.2. I'm currently supporting any device with GPS that can run ios 9.2
I started with the Tabbed View Template and I'm working in wAny and hAny and a single Storyboard.
It works fine in the simulator on a bunch of phones, both orientations and works fine on my 6s plus, 6s, 6 plus and a 5.
But for some users the scaling is wrong and everything comes out squished.
Even in landscape mode the TabBar Icons are very close to each other.
Narrower than even on my 6s plus in portrait.
I believe this is caused by my application not having a Launch bitmap.
My understanding is there are two ways to implement this.
Launcher .XIB/.NIB with half a dozen specific sized bitmaps attached. Or a StoryBoard Launcher with ... exactly what.
The "Or StoryBoard" is a little vague. But I wanted to keep things using the modern approach since this app is new and targeted users tend to have the latest device.
So I created my Launch Image set and tried to attached it to the UIImageView in the Launcher StoryBoard. It won't list items that are tagged as "Launcher Image Set". It will show other Image Sets and Icons. But not the ones specifically for Launcher. It shows an "L" in the xcassets list next to the Launcher Image set. I believe I have the build project setting set correctly and it looks perfect on many of the same exact devices.
After some digging, I read that if you use the "StoryBoard" method you don't need the 6 or so bitmaps anymore. You can put anything in the Storyboard Launcher View and treat it just like you would treat your main storyboard.
So I did that. I just centered a small image.png file in the View of the Launchers Storyboard. Works on all simulations and my iPhone 6s plus. I did not pin it to the edges because that would mess up the aspect ratio of the image.
A very small set of users still have the issue and one of them even uninstalled and reinstalled.
I tried playing with setting phone Zoomed, Normal, Text Size, Bold etc. They all work. Users also don't have anything out of the ordinary on these system settings.
So first, do I need the 6 proper sized bitmaps or not? I read conflicting info on this.
If I want to use the 6 images on a storyboard how to I get them in the UIImageView of the Launcher StoryBoard if they won't list? Should I put them in a regular image set. Does the "Launcher Image Set" only work for the for the Launcher.XIB?
If it's not the Launcher window, what else could it be causing this?
I know I could create a XIB/NIB with the 6 bitmaps. But that seems like I'm going backwards and I don't care about old OS versions or older phones.
I think I found my answer. When using a Storyboard Launcher you cannot use a "Launch Image Set" for your Launcher Storyboard. You have to use an Image Set.
This is the best Video I found that covers it A-Z.
https://www.youtube.com/watch?v=Vz6tCgXgZFo
It also didn't fix my initial problem. Which I'll post separately. It scales correct in Portrait but not in Landscape for hand full of users. Using the same hardware as others that it works fine on.

Launch Image does not show up in my iOS App

I want to get a simple launch screen to show in my app, built using Xcode 6.0.1.
I have added a launch screen in two ways: As an XIB (with the default name, LaunchScreen.xib) and as a launchimage set within xcassets.
I have made sure that my "Launch Screen File" is set to LaunchScreen.xib.
I have simulated every device available (e.g., "iPhone5 iOS8" / "iPhone5s iOS8" / "iPhone6 iOS8". Note that only iOS 8 is available within the simulator).
So this has been quite painful for something that should be trivial. Here is what I did:
Use xcassets
I decided to use .xcassets versus the .xib for launch. I deleted the .xib. If you have images.xcassets already in your project then great, otherwise you can add one from File>New>file:
Create a Launch Image Set
Now create at a minimum a launchimage set and icon set in your .xcassets file by right clicking in the navigator area.
Update the App Icons and Launch Images Settings
Then I made sure that the "Apps icon and image sets" in my target are as below.
Very Important: Make sure the "Launch screen file" setting is blank.
Add the Images
Last but not least, the terminology used by Apple for the device selection is confusing. Initially I thought that since I am deploying for iOS8 only (iPhone Portrait), I can do this and just put in the iPhone 6 and iPhone 6+ launch images:
I quickly realized that is not the way this works and I was getting a warning:
"An iPhone Retina (4-inch) launch image for iOS 7.0 and later is required."
So I had to select the iPhone under iOS 7.0 and later as well and add an Image for the iPhone 5s.
So to find out which boxes to check on the right, do not ask the question: What is my minimum iOS and device and device orientation but rather ask:
What devices out there can support my minimum iOS? Now What is the minimum iOS supported on those devices? And make sure you check all of those boxes. So for me, I am targeting iPhone 5s, 6 and 6 Plus at 8.0 but given that iPhone 5s can exist with 7.0, I need to check the 7.0 box as well to show the image placeholder. In other words, the (iOS) check box on the right shows you the minimum iOS version available for that device and you need to click it to show the image placeholder and put an image regardless of whether you are deploying at this iOS version or not.
The LaunchScreen.xib and the info value Launch screen interface file base name are from my experience both placeholders that are created when the project is created. If you would like to use the Images.xcassets exclusively for your launch screens, delete both the LaunchScreen.xib and the info.plist item.
If you provide the info.plist setting you app will use the xib and not your Images.xcassets
Xcode 8:
Images used in LaunchScreen.xib should not be on a .xcassets, try dropping them in the bundle.
Looks like that by the time that the .xib gets loaded, the images in the .xcassets are not yet available.
EDIT: For some opaque reason after adding some localizations, launch screen stopped working, now it works with an image from the assets, extremely weird.
My solution was to create all the launch images.
Then I set the Launch Images Source to the LaunchImage asset, and leave launch screen file blank.
Finally if the project does not have a Launch Screen.xib, then add that file and leave it as is.
For me, it worked when I uninstalled the app and then restarted the simulator.
When installed again, launch image appeared as expected.
This also worked on an actual device.
For the people who are using the Asset Catalog's Launch Image, as I learned this the hardest way, I had this scenario where I was first given a jpg file then I asked them convert it to PNG.
I trusted them enough that I scoured the internet first as to why the launch image wasn't showing and did every solution to no avail, then I tried putting back the old launch image and was working fine, it was there that I thought what I have is not a proper PNG file.
TL;DR: Make sure that you are actually using a proper PNG file, not a file with a renamed extension.
Removing "Launch screen interface file base name" from Info.plist file AND trashing "Launch Screen.xib" worked for me.
Simply removing and reinstalling the app worked for me:
Testing in the Simulator
Delete the app in the simulator.
Quit and restart the simulator.
Run the project again in Xcode.
Testing on Device
Delete the app from the device.
Run the project again in Xcode.
The problem with the accepted answer is that if you don't set the Launch Screen File, your application will be in upscaling mode on devices such as the iPhone 6 & 6+ => blurry rendering.
Below is what I did to have a complete working solution (I'm targeting iOS 7.1 & using Xcode 8) on every device (truly, I was getting crazy about this upscaling problem)
1. Prepare your .xcassets
To simplify it, I'm using a vector .PDF file. It is very convenient and avoid creating multiple images for each resolution (1x, 2x, 3x...). I also assume here you already created your xcassets.
Add your launch screen image (or vector file) to your project
Go to your .xcassets and create a New Image Set. In the Attributes window of the Image, select Scales -> Single Scale
Drag and drop the vector file in the Image Set.
2. Create your Launch Screen file
3. Add your image to your Launch Screen file
Add an Image View object to your Launch Screen file (delete the labels that were automatically created). This image view should refer to the previous .xcassets Image Set. You can refer it from the Name attribute. At this stage, you should correctly see your launch screen image in your image view.
Add constraints to this image view to keep aspect ratio depending on the screen resolution.
4. Add your Launch Screen file to your target
Fianlly, in your Target General properties, refer the Launch Screen file.
Start your app, and your splash screen should be displayed. Try also on iPhone6 & iPhone6+, and your application should be correctly displayed without any upscaling (the Launch Screen file aims to do this).
After several hours frustrated on this, I decided to use this way. It works for both iPhone and iPad (on Xcode 6.1)
File >> New File >> User Interface >> Launch Screen
Create new key/value: "Launch screen interface file base name"/"Your Launch Screen Name" in YourApp-Info.plist
1 picture worths more than thousand words. Please look at below:
I've read about a bug in Xcode 6 which prevents landscape only apps from displaying a launch image.
Try to set images and orientation within Images.xcassets:
There is a bug where Xcode 6 launch images stored in asset files cause iphone landscape only apps on iOS7/iOS8 to display a black launch image. iPad works fine.
http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=10868
Solution:
Use the new Launchscreen.xib for ios8+ onwards. (it is far better)
For ios7 devices to work you simply turn off launch images source and use the old school launch images file names in the plist
iphone5 - Default-568h#2x.png
iphone4s - Default#2x.png
ipad2 - Default-Landscape~ipad.png
ipad retina - Default-Landscape#2x~ipad.png
Painful but works.
B
I have tried everything but solution was extremely simple. Just use .jpg file instead of .png on your LaunchScreen.storyboard. It seems like iOS does not render .png file or relatively big image size at launch screen.
Do what Spectravideo328 answered and:
Try to UNCHECK the iOS 7 and later box and CHECK the iOS 6 and prior box in the asset catalog. There seems to be a bug with the iOS 7 Launch Image.
(These both have the same Launch Images except for the 320x480 one)
Hope this helps, it did help for me!
I set up "LaunchImage" in my asset catalog and simply cleared the "Launch Screen" field et voila ! I had the launch images appear ...
One way is to also add "Launch Screen" (LaunchScreen.xib), paste the image into UIImageView and then set it to "Horizontal Center in Container" and "Vertical Center in Container" in "Align" if you are using Auto Layout.
Screen:
http://i.stack.imgur.com/CfnHT.png
Don't forget to put LaunchScreen.xib into "Launch Screen File".
I had the same issue after I started using Xcode 6.1 and changed my launcher images. I had all images in an Asset Catalog.
I would get only a black screen instead of the expected static image. After trying so many things, I realised the problem was that the Asset Catalog had the Project 'Target Membership' ticked-off in its FileInspector view. Ticking it to ON did the magic and the image started to appear on App launch.
Make sure your images are accurate size according to Apple guidelines.
Make sure, You will select only one option , either launch screen file or Launch Image Source. You can find these two options in Project build settings -> General
My suggestion to you is to select Launch Image Source as Image.Assets. Create splash image assets there in Image.assests folder.
Reference image for right configuration:
If you have changed your launch image from a previous image, and observe the following:
devices/simulators where the app was previously installed, still show the previous image and refuse to show the new one (uninstalling and reinstalling the app doesn't help)
devices/simulators where the app was not previously installed, show the new launch image
It is likely because of the caching of launch image done by iOS. Rebooting the device should solve the problem.
I tried opening a new project, and moving through the same steps you did to set a launch screen.
By default, the .xib was set as "Launch Screen File," and the white screen with a label did show for half a second in the simulator.
I then a "Launch Images Source" and set it to the Images.xcassets which generated with the background images I added to the project. (all good so far)
Rerun the simulator and the launch images don't show...
After deleting the specified "Launch Screen File" and a clean: Product -> Clean, from the top menu, the launch images finally show up.
Maybe that will help?
There is a file 'LaunchScreen.xib' automatically added to your project
Deleting this will shift xCode to using your Default images in Images.xcassets
edited to add
go to App Icons and Launch Images
Launch Screen File should be blank/emtpy
I had a very strange bug. Apparently my launch image source was only set for debug configuration and not release. This resulted in my launch screen appearing when running debug configuration, but when I changed to release I just got a black screen.
I fixed this when I changed my build configuration to release the Launch Image Source button appeared and I had to choose Use Asset Catalog again.
For those who are curious, this is what my project.pbxproj looked like.
...
...
...
XXXXXXXXXXXXXXXXXXXXXXXX /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; <---THIS LINE WAS MISSING
...
...
...
For some reason, I had to change the asset catalog location to "relative to project" for this to work.
I had also deleted the app from my phone and reinstalled, but it was probably the "relative to project" that did it.
* (Xcode 7.2 / Deployment Target 7.0 / Landscape Orientation Only) *
I know is an old question but with Xcode 7.2 I'm still getting the message and I fixed with this:
1) Select PORTRAIT and both landscapes. Add "Launch Images Source" and "Launch Screen File"
2) In your Launch Image select iPhone "8.0 and Later" and "7.0 and Later".
3) Add this code in your appDelegate:
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
#else
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return (UIInterfaceOrientationMaskLandscape);
}
#endif
4) Add this on your ViewController
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
return UIInterfaceOrientationMaskLandscape;
}
I hope help to somebody else.
This is worked for me. Click LaunchScreen.storyboard then in the right panel you can select "Is Initial View Controller" check box.
LaunchScreen.storyboard -> Is Initial View Controller
I just figured this out. My launch image was not showing up, I get a white screen when launching on a device (iPhone 6, 7+) or testFlight. Fix: Renamed "Landing_screen.png" to just "Landing_screen" removing .png part. The image icon in Xcode changed to white icon and in the launch screen storyboard the image appears as a question mark now. The Launch image now appears and not the white screen. My Setup: I am using Swift 3.1 with Xcode 8.3.1. In LaunchScreen.storyboard I added a simple image view and stretched the image to fit the view controller. I set auto layout constraints Top/Bottom/Leading/Trailing space to superview to 0.
I encountered this bug also with my landscape-only app. Following carlodurso's solution works:
tick the "Landscape" box
drag and drop the image to the place.
For me, it works when I remove LaunchScreen.xib and change it to a storyboard file LaunchScreen.storyboard.

Xcode landscape launch image warning when not required

I am finishing up an app which only runs in portrait mode on the iPad and iPhone. As a result, I don't provide any landscape launch images - I could include them, but they would never be seen, so I'd prefer to save the space in my app.
How do I stop XCode trying to auto assign 'Default.png' and 'Default#2x.png' into the landscape images for the iPad? This causes a warning to appear, since these images are for the iPhone and so are the wrong dimensions. Alternatively, a solution to suppress the warning that appears would suffice.
Control-click on an unwanted iPad launch image in the Summary window and choose Delete. This will remove the reference to the image as a launch image for iPad. Even better, go ahead and include solid black PNG images for the unneeded launch images. They will be compressed by Xcode when it builds your app, so that they will take up virtually no space in the app bundle.
I regard the fact that Xcode automatically creates default launch images for iPhone but not iPad as a bug. I suggest you complain about this behavior at bugreporter.apple.com.
EDIT: Just to be clear, what you want is a minimal set of properly sized images with the following names:
Default.png
Default#2x.png
Default-568h#2x.png
Default-Portrait~ipad.png
Default-Landscape~ipad.png
Default-Portrait#2x~ipad.png
Default-Landscape#2x~ipad.png
This will prevent Xcode from using e.g. an iPhone launch image in an iPad slot.

Resources