UIImageView missing images in Launch Screen on device

IosObjective CUiimageviewUiimageLaunch Screen

Ios Problem Overview


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.

Ios Solutions


Solution 1 - Ios

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 https://stackoverflow.com/questions/49478/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

Solution 2 - Ios

"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

Solution 3 - Ios

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 !

Solution 4 - Ios

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.

Solution 5 - Ios

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

Solution 6 - Ios

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.

Solution 7 - Ios

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;

Solution 8 - Ios

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.

Solution 9 - Ios

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

Reset content and Settings menu

Solution 10 - Ios

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.

Solution 11 - Ios

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

Solution 12 - Ios

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

Solution 13 - Ios

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

Solution 14 - Ios

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.

Solution 15 - Ios

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)

Solution 16 - Ios

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.

Solution 17 - Ios

I think launchscreen only support image in Assets.xcassets.

Solution 18 - Ios

Restarting Xcode did it for me.

What did not do it:

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

Solution 19 - Ios

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.

Solution 20 - Ios

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

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

Solution 21 - Ios

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.

Solution 22 - Ios

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.

Solution 23 - Ios

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

It worked for me.

Solution 24 - Ios

This is too important Must be empty! Launch Screen File

enter image description here

Solution 25 - Ios

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!

Solution 26 - Ios

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.

Solution 27 - Ios

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

Solution 28 - Ios

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.

Solution 29 - Ios

Simple solution is to use JPG instead of PNG.

Solution 30 - Ios

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

Solution 31 - Ios

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

Solution 32 - Ios

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

Solution 33 - Ios

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.

Solution 34 - Ios

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

Solution 35 - Ios

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMFWView Question on Stackoverflow
Solution 1 - IosAral BalkanView Answer on Stackoverflow
Solution 2 - IosNikLanfView Answer on Stackoverflow
Solution 3 - IosgbitaudeauView Answer on Stackoverflow
Solution 4 - Iosmayankk2308View Answer on Stackoverflow
Solution 5 - IosandrewbuilderView Answer on Stackoverflow
Solution 6 - IosBruce LView Answer on Stackoverflow
Solution 7 - IosKe YangView Answer on Stackoverflow
Solution 8 - IosPetro ShmView Answer on Stackoverflow
Solution 9 - IosandynilView Answer on Stackoverflow
Solution 10 - IosJim RhoadesView Answer on Stackoverflow
Solution 11 - IosJakub TruhlářView Answer on Stackoverflow
Solution 12 - IosTrinh TranView Answer on Stackoverflow
Solution 13 - Iosmidhun pView Answer on Stackoverflow
Solution 14 - Iosbonnie lapinView Answer on Stackoverflow
Solution 15 - IosguozqzzuView Answer on Stackoverflow
Solution 16 - Iososcar castellonView Answer on Stackoverflow
Solution 17 - IosSunlyView Answer on Stackoverflow
Solution 18 - IosManuelView Answer on Stackoverflow
Solution 19 - IosAsha AntonyView Answer on Stackoverflow
Solution 20 - IosAmon XuView Answer on Stackoverflow
Solution 21 - Iosde.View Answer on Stackoverflow
Solution 22 - Iosostap_holubView Answer on Stackoverflow
Solution 23 - IosJesseView Answer on Stackoverflow
Solution 24 - IosSwiftDeveloperView Answer on Stackoverflow
Solution 25 - IosVladimir TolstikovView Answer on Stackoverflow
Solution 26 - IosJamieDassView Answer on Stackoverflow
Solution 27 - IosTim LeView Answer on Stackoverflow
Solution 28 - IosFox5150View Answer on Stackoverflow
Solution 29 - IosKINGView Answer on Stackoverflow
Solution 30 - IosAproramView Answer on Stackoverflow
Solution 31 - IosBreno Medeiros de OliveiraView Answer on Stackoverflow
Solution 32 - IosHoang QuanView Answer on Stackoverflow
Solution 33 - IosgklkaView Answer on Stackoverflow
Solution 34 - IosWang3tView Answer on Stackoverflow
Solution 35 - IosnfinfuView Answer on Stackoverflow