By MFW


2015-09-15 06:29:40 8 Comments

I have an app that supports iOS8 and later, built in Xcode 7 and I am using a XIB for a Launch Screen (I do not have launch images). The view contains a single UILabel with the app version, and 2 UIImageViews with images that are both present in Images.xcassets: A logo and a splash image.

The UILabel and the logo image appear correctly when I launch the application, but the splash image does not if I run the app on an iPad Air 2 with iOS9. I have tested on an Air and a Mini running iOS8, and iOS9 simulators for iPad 2, iPad Air, and iPad Air 2 and the image appears correctly in all of those.

I ran some basic troubleshooting to see if I could figure out what is going on but I haven't been able to solve it and the only difference I can see between the image that's working and the one that's failing is when I added it to the assets...

Here's a rundown of what I know:

  • The UIImageView for the splash image is in the correct place, at the correct size. I can tell this because I set its background color to green just to make sure. The view is there, but the image does not appear. So I'm assuming that the view is not to blame.

  • Setting the UIImageView for the splash image to also use the logo image makes the logo image appear in the correct place for the view. This also leads me to assume that the view is not to blame.

  • The UIImage that I am using in the splash image view is used elsewhere in the app and appears fine in those other views (the logo image is also used elsewhere in the app and appears fine). So I'm assuming that the image is valid and having it appear in other views is not a problem.

  • I've confirmed that the settings of the UIImages for the logo and splash in the xcassets file are the same. They are set to Universal, Any width and height, multiple scale factors, rendered as default. There is one difference - the logo has 1x, 2x and 3x scales while the splash image only has 1x and 2x, but I have also tried using UIImages with only 1x, and 1x and 2x values in the UIView and they work (if they were added to the project some time ago).

  • Adding another image of a different size or format (PNG and JPG) to my xcassets and using that UIImage in the UIImageView for the splash image also fails to display.

  • Adding another UIImageView to the XIB file and allocating it a UIImage that was already in the xcassets works, the image appears in the loading screen.

  • Copying and renaming the image files used for the logo and adding them to the project then using that UIImage in the splash view also fails to display.

  • I have tried cleaning the project, restarting the development machine, and deleting the app from the Air 2 and reinstalling it just in case that was a problem.

These last three steps lead me to believe that there's some issue with images added after a certain point in the project file's lifetime. While I updated to Xcode 7 yesterday, the splash image was originally added in Xcode 6, but the logo image (also added in Xcode 6) was added some months before.

I've looked over the json files for the logo image and splash image and they appear to have the same format. I've also trawled through the pbxproj file looking for differences and I can't see any.

So I was wondering if anyone had any idea why the launch screen might not display these new images I'm adding on the Air 2 specifically? Other questions I've been reading through relating to images not appearing all seem to relate either to Launch Images, or to images in XIB files that have associated classes, neither of which seems relevant here.

30 comments

@KING 2018-06-05 21:24:16

Simple solution is to use JPG instead of PNG.

@midhun p 2019-04-25 06:42:51

Remove app from mobile and then restart mobile and install app again. now the issues will be solved

@Breno Medeiros de Oliveira 2018-11-12 22:01:33

SOLVED!

The only thing that worked for me was deleting the ViewController from LaunchScreen.storyboard and create a new ViewController set to

Is Initial View Controller

Simple as that :)

@Jakub Truhlář 2016-02-28 19:02:56

Have you tried turning the device off and on again? Do it.

@无夜之星辰 2018-09-03 09:23:01

I did, and problem solved.😂

@Aproram 2018-06-06 17:36:28

Image name is the problem. Rename the image name used inside the Launch screen storyboard. Make sure not to use any character other than alphanumeric ( don't use "_-&@") Worked for me like a charm..

@Petro Shm 2016-01-28 16:59:08

I had the same for app installed from TestFlight. Delete app -> then restart iPhone -> then reinstall app works for me. Just reinstall app or just restarting device didn't help.

@KML 2016-04-22 12:10:23

This is the only thing that worked for me - wish I had seen this 90 minutes ago !

@gerry.liang 2016-05-31 09:12:47

wish I had seen this 4 hours ago

@CSawy 2017-05-17 16:35:39

this worked for me. WTH Apple!!

@NoProb 2018-05-03 09:21:03

Worked for me as well, but the problem is weird :|

@SwiftDeveloper 2016-09-07 11:35:45

This is too important Must be empty! Launch Screen File

enter image description here

@benck 2017-09-30 01:58:22

He's using the XIB storyboard for launching, this answer will not work.

@Ke Yang 2018-01-08 02:58:54

My solution @iOS 11.x:

  • Use .jpg image instead of .png. I think image file size matters;
  • (Optionally) Put image file in project directory rather than .xcassets;

@Husam 2018-01-13 14:17:18

Putting the image file outside of .xcassets helped

@Ke Yang 2018-01-13 14:47:27

@Husam I really think it’s file size that only matters. I have a launch screen with two images: a large one (400+KB .png) and a logo (10+KB .png, inside .xcassets). The logo always show up normally, but the large one doesn’t.

@Husam 2018-01-13 16:21:59

You are right .. After my comment the issue appeared again after adding another image. Thanks for your help

@Husam 2018-01-13 16:30:26

Then followed your instructions by using jpg image and worked

@de. 2017-11-13 15:58:37

In my case I it was the image name.
I added an image named [email protected] to LaunchScreen.xib - one of my old launch screens just for testing purposes. I was building on the iPhone X Simulator, the image didn't show up.

Changing the name to something neutral (MyImage.png) solved the issue.

It seems that the @2x was part of the problem as well as the -568h. Which makes some sense on a [email protected] device.

@nfinfu 2017-10-04 18:26:57

Select your image file from left menu, select "show the file inspector" from right Utilities menu. Under target membership make sure your target is selected. I added the image with selecting the target but I don't know why it was unselected. I tried all solutions, restarting, deleting etc. no one works. Just this worked. Hope it helps someone else.

@Wang3t 2017-09-22 18:21:48

"myProject" is with many images initiated from Images.xcassets. But I Ran into missing images after deleting and restoring “Assets.xcasset” from project.

  1. Deleting Images.xcassets accidentally, but
  2. Adding Images.xcassets back to "myProject"

I ran into this missing images problem, and tried following methods:

  1. Recycle power of the device, but it doesn’t work.
  2. Using Xcode to "build" project after "cleaning", and it doesn’t work either.

Solution to fix my problem:

  1. Added every and each image inside Images.xcassets back to "myProject" via Xcode in “Target Membership” at “Show in File Inspector” and it is back to normal.

@oscar castellon 2017-09-18 03:04:28

it's worked for me.

First in xcode clean de project.

If you use the simulator, delete app and relaunch.

If you use a device, delete app and restart the device.

@Fox5150 2017-08-08 08:44:10

I found a simple but radical solution that worked for me :

1 - Delete the file : LaunchScreen.storyboard and move it to trash.

2 - Product -> Clean

3 - Create a new launch screen file named : LaunchScreen.storyboard and put your images in it

4 - Save and build

That worked for me after trying complex methods for hours... It seems that my LaunchScreen.storyboard was write-locked and couldn't be saved or a weird caching process was blocking it.

@NikLanf 2016-02-18 12:33:09

"The solution for me was simply to make sure that the "Clears Graphics Context" box is unchecked for the UIImageView in the storyboard. Just changing this fixed it for me." No other solutions worked for me. Got it from apple developer forum

enter image description here

@Nuthatch 2016-05-14 23:32:51

Damn, I never would have thought to try this. Fixes Simulator and Device with Xcode 7.3.1 (7D1014) and iOS 9.3.2 Developer Beta 3.

@Torbjørn Kristoffersen 2016-06-18 18:35:36

I can confirm this also worked for me. Xcode 7.3 and iOS 9.3.2.

@lonesomewhistle 2016-06-23 12:59:11

Even with mine already checked -- unchecking and rechecking did the trick!

@Josip B. 2016-07-07 16:18:58

When having image in .xcassets this doesn't work but after adding image directly to project this started working. Thanks!

@iGatiShah 2016-07-22 11:49:32

Damm! Weird. +1 for your answer! Thanks a lot. Saved my time.

@Skovie 2016-09-23 12:21:04

Nice +1 for your answer , works in Xcode 8 and iOS 10 as well

@vinbhai4u 2016-10-05 12:07:38

This only worked for me when The image is directly added to the project not trough assets which sadly is only in 1 size

@xaphod 2017-04-10 14:56:49

Thanks! Fixed this issue for me in XCode 8.3, launchscreen storyboard, using a PDF/vector image from assets catalog

@Chris Knight 2017-08-23 20:28:55

YESSSSSSSSSSSSSSSSSSSSSSSSSS!!!!!!!!

@Fábio Salata 2017-09-26 12:15:50

Thank you very much man!

@StephenT 2017-10-01 17:42:22

Fixed it for me in Xcode 9/iOS 11.

@jberlana 2017-11-15 09:23:17

This is the correct answer. Proved on iOS 11, on device.

@Aaron Smentkowski 2017-12-15 18:19:41

Why in the hell do they automatically check this for you? Thank you so much, you saved me a lot of time.

@Vladimir Tolstikov 2016-10-27 13:30:37

Next helped to me:

  • change "Launch Screen File" to another xib
  • run the app
  • change xib back

Also very important: check that your is xib not opened in another tab, that can cause it as well!

@Tim Le 2017-04-27 22:05:06

I experience the same. I change image resolution from 300 pixels/inch, change it to 72. It works for me.

@JamieDass 2017-04-03 20:43:27

I had this problem in iOS 10 on an iPhone 6 and also in the Simulator. My image was in a folder and that seemed to be the issue. I removed the image from the folder in Xcode and put it in the project's base directory which solved the problem.

@andrewbuilder 2016-04-19 02:58:53

Many other answers suggest rebooting devices and / or rebuilding and / or reinstalling is the solution.

While these answers work for some of us, the reason these work is because the app is forced to "retake" or "rebuild" cached snapshots.

Cached snapshots are used by apps to present images before supporting data is loaded into memory, including the asset catalogue that contains storyboard images.

This SO answer by @jaga provides the solution, but not the reason, as to why UIImageViews are missing in the Launch Screen on device (but not in the simulator).

Background

Recently I attempted to use a custom font in my "Launch Screen.storyboard" file.

The reason I could not became clear after reading this SO answer by @TimCamber, which prompted me to do a little more research and testing.

The reason that a custom font is not included in my Launch Screen Storyboard file is the same reason an image within an asset catalogue is not included...

The app prepares portrait & landscape snapshots of the app's Launch Screen from your Launch Screen Storyboard file and (currently) saves it in your app bundle here:

  • /Library/Caches/Snapshots/<<app_bundle>>/ and
  • /Library/Caches/Snapshots/<<app_bundle>>/downscaled/.

This process is complete before any supporting files are loaded, including any custom fonts and the asset catalogue.

Solution

As mentioned above by following @jaga's solution, literally all that is required is to:

  1. (old school) add an image file (.PNG) to your app's bundle (as you can see from the screenshot below I added the image file under the Supporting Files subdirectory in an Images subdirectory), and

screenshot of relevant directories in Project Navigator in Xcode

  1. reference that image in your UIImageView object in the Launch Screen Storyboard file...

screenshot of Image View section for UIImageView under Attributes Inspector in Xcode

@James Laurenstin 2016-09-05 06:59:07

Thank I've been wrestling with this for a little while. That works for me.

@Mohammad Shraim 2017-03-29 23:49:17

worked for me directly. this should be the correct answer

@icould 2017-04-12 07:25:12

On Launch IOS was not able to compile assets so placing your image to bundle works. Thanks.

@MoVod 2017-05-10 15:55:44

Best answer so far. I will add this: the image has to be in the app-bundle's root directory. Otherwise you have to give the full path "Media/launch_v1_200_mod.png" if you store images in a sub dir.

@Punit 2018-10-24 13:15:51

I did the same. My app is already live but the issue is sometimes it is showing the image and sometimes it shows square with white color in the middle of the screen

@Sunly 2017-02-28 08:13:04

I think launchscreen only support image in Assets.xcassets.

@Ercan Celik 2017-11-02 21:25:34

I tried all the answers above and none of them worked for me. But this answer solved the issue.

@Asha Antony 2017-02-09 12:06:14

Select the ImageView and then remove the image extension (.png or .jpg) in the attributes inspector tab > Image view > Image > Image Name.

On launchscreen.storyboard the image will not appear but it will be there in device. This worked for me.

@fl034 2018-06-26 12:46:23

This was my problem too. Strangely it randomly worked on some devices. Xamarin-Project with Xcode 9.4 for XIB/Storyboard editing...

@andnil 2017-01-08 04:58:40

What worked for me was to select Reset Content and Settings... from the Simulator menu

Reset content and Settings menu

@AbdulMomen عبدالمؤمن 2017-03-28 13:06:04

this worked with me

@guozqzzu 2016-12-02 03:52:15

I use the iPhone 5s device, also meet this problem.

I fix it by :

  • Remove Drive Data

  • Clean the project

  • Restart Xcode

  • Remove the project from my device

  • Restart the 5s.

I think it's something wrong of Xcode to use memory, system may be allocate a little memory for Xcode cause Xcode drawing the lunch image failed (On my computer , Xcode have runned for several weeks without close)

@Arpit B Parekh 2017-01-21 12:20:44

I do not know, but it worked.. like good. Thanksw man for sharing.

@mayankk2308 2016-08-07 08:04:57

The following sequence of operations fixed the issue for me on Xcode 7.3.1 and iOS 9.3.4:

  1. Clean Your Build (⌘+⇧+K)
  2. Close Xcode
  3. Hard Reset iOS Device (Power + Home Button reboot)
  4. Relaunch Xcode - let indexing finish and build on device once it is ready.

@Zack Zhu 2016-10-03 23:44:19

Saved my day! Thanks!

@Timothy L.J. Stewart 2016-10-23 17:41:30

Worked. I did not do steps 2 and 4, Perhaps only a Hard Reset of the iOS device is needed, can anyone confirm this?

@mayankk2308 2016-10-23 18:49:34

@TimothyL.J.Stewart Steps 2 and 4 were just more precautionary steps that I had taken because the issue was quite an annoyance for me - so it was just to be sure. I think you're right in saying they might be unnecessary since they do not really (typically) affect the build.

@Timothy L.J. Stewart 2016-10-23 19:39:01

Xcode 8 Swift 3.0 Powering off or Hard Resetting is the only thing that works every time, and must be done every time a new asset is added. Deleting DerivedData does not. However, the image works properly in the simulator. This has wasted so much of my time, thank you @MayankKumar for the solution.

@Wilson 2016-11-30 00:49:12

This worked for me, thanks Mayank!

@Greg Hilston 2017-06-14 21:18:56

This worked for me, I hate that this was the problem...

@Cristina 2017-08-03 09:24:34

This worked for me, thanks!

@Naveen Ramanathan 2017-08-09 13:01:08

This worked for me too

@lborgav 2017-08-13 01:01:04

Worked like a charm

@Kubee 2018-04-11 00:37:48

This worked for me on my device and simulator. I didn't even need to restart Xcode. iOS 11.3

@Jesse 2016-08-03 13:46:07

Also can 1. delete project image 2. change image name 3. add file image to project

It worked for me.

@gklka 2016-07-11 08:10:15

For me, the problem was that the size of my Launchscreen was off by 1 pixel (2209x1242 instead of 2208x1242). Correcting it, then rebooting the device and rebuilding the app helped.

@Hoang Quan 2016-07-06 15:27:27

In my case, i just go to app TARGETS -> General -> App Icons And Launch Images -> Launch Images Source Then select source where i put the images Hope this will help you

@Amon 2016-05-12 04:12:34

It seemed a bug of iOS. Like sometimes the system animation disappeared.

Now I just reboot the iPhone and it is worked for me.

@ostap_holub 2016-04-21 13:08:22

I have the same issue with imageView a launch screen storyboard. I removed reference of picture from project, I renamed my image and added it again to project. All works perfectly.

@Trinh Tran 2016-03-29 04:00:35

Bring images out of Image.xcassets and add them again to project. It worked for me.

@andrewbuilder 2016-06-07 11:27:13

That works only because you are forcing the app to recreate the Launch Screen snapshots, but it is not a solution to or reason for the problem.

@Manuel 2016-03-21 23:33:31

Restarting Xcode did it for me.

What did not do it:

  • Clean build folder
  • Restart device or simulator (image wasn't visible on either)

Related Questions

Sponsored Content

23 Answered Questions

[SOLVED] iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta

5 Answered Questions

[SOLVED] Launch Screen that behaves exactly like Launch Image

15 Answered Questions

[SOLVED] iOS 9 Splash screen is black

0 Answered Questions

XCode launch image for different targets

1 Answered Questions

[SOLVED] Images on Launch Screen doesn't appear on device

1 Answered Questions

[SOLVED] iOS 10 Launch Screen Bug

1 Answered Questions

Launch Screen File with different images

0 Answered Questions

iOS8 black screen before splash screen on URL app launch

0 Answered Questions

Use a Launch Screen and Launch Image in Asset Catalog

2 Answered Questions

[SOLVED] UIImageview custom splash screen frame issue

Sponsored Content