306
votes

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
Been meaning to reply on this - I came back and read over the answers provided, then returned to Xcode and re-adedd the UIImageView and image in order to try them out. This time, it worked without any changes. I have no clue why - same version of Xcode, I restarted, rebuilt, cleaned and removed the app before, same iOS, same Mac OS, it just worked. So unfortunately I haven't been able to verify if any of the solutions would have helped.MFW
For me NONE of the provided answers solved the problem. Simulator, iPhone 5, iPhone 5 SE, iPad 4 are all displaying the UIImageView within my LaunchScreen.xib correctly, iPad Air 2 won't show it. Rebooted all devices, re-installed on all devices. Behaviour remains.Christian
Hey you should accept the 130+ voted answer.Khanh Nguyen
I agree with Khanh, it is working for most!!gunjot singh
@MFW, ACCEPT THE ANSWER FFS! IM REPORTING U TO THE COPS.GeneCode

30 Answers

479
votes

Turn if off and then on again.

Seriously, restart the device — that’s what fixed it for me.

Here’s what didn’t work:

  • Cleaning DerivedData
  • Cleaning the project
  • Uninstalling the app from the device
  • Restarting Xcode
  • Restarting the computer

Older observations:

Just like the others, it:

  • Works fine in the Simulator
  • Used to work on the devices (iPhone 5S, iPad Air)
  • No code changes (verified via git reset --hard HEAD), yet stopped working.

What I remember triggering the first build where it stopped working was unplugging the iPhone while it was runnning. (Not sure if it’s related.)

However, the git reset not fixing it (combined with all the clean steps not working) tells me it this must be getting cached somewhere else. Quite possibly in one of the .gitignored files? (I’m using Git ignore file for Xcode projects)

One workaround that worked for one UIImageView (in the UIView that has three) but not for the others was putting the image into an .xcassets file. Reverting to the plain image file did not undo the fix. (Really feels like a caching error.)

UPDATE: See top — restarting the device is what fixed it. I get the feeling the wrong bitmap data is being cached on the device itself.

Radar: http://openradar.appspot.com/23534818

154
votes

"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

100
votes

I had exactly the same issue on an iPhone 6.

The very strange fact is that I was able to use another image from my images.xcassets which had the same size, compression, color space ...

I'm not able to find why it doesn't work but I found a solution : Simply put your file outside your images.xcassets and use its full name (with extension) in Interface Builder

splashScreen in storyboard sample

Hope this help !

33
votes

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.
28
votes

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

21
votes

I was seeing the same problem. Rebooting the device (iPhone 6) and rebuilding the app to the device is the only thing that fixed it. I tried many other tips and suggestions but nothing else worked. Only reboot + rebuild helped.

18
votes

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;
16
votes

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.

8
votes

I was having the same problem, but restarting the device didn't help. What worked for me was deleting the UIImageView from my launch storyboard and adding a new one.

8
votes

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

Reset content and Settings menu

8
votes

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

6
votes

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

6
votes

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

5
votes

I also had this exact problem in Xcode 7 with iPad and iPhone devices. Although it makes no sense, I was able to get around it most of the time by setting not only the Image but also the Highlighted image in the image view to the same image in my images.xcassets.

5
votes

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)

5
votes

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.

4
votes

I think launchscreen only support image in Assets.xcassets.

3
votes

Restarting Xcode did it for me.

What did not do it:

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

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.

2
votes

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

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

2
votes

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 -812h@3x device.

1
votes

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.

1
votes

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

It worked for me.

1
votes

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.

1
votes

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

1
votes

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!

1
votes

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.

1
votes

This is too important Must be empty! Launch Screen File

enter image description here

1
votes

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..

1
votes

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 :)