Launch Screen storyboard not displaying image
Asked Answered
V

38

254

I'm trying to get an image to display as the launch screen from my Launch Screen.storyboard file, however the image never displays. I have labels that show up fine, but the image doesn't appear.

This is how the launch screen looks in the Launch Screen.storyboard file: enter image description here

However when I run the app on the simulator (as well as on the physical device) this is what shows up:

enter image description here

As you can see, the label "Test" shows up fine, however the image does not display. I'm really not sure why this is happening and nothing I try seems to work. If anyone has any ideas of how to fix this it would be greatly appreciated.

Violette answered 16/4, 2016 at 20:24 Comment(8)
make sure that your image is in proper png format. not jpg if it is.Overrule
Check this https://mcmap.net/q/111477/-launch-image-not-showing-up-in-ios-application-using-images-xcassetsJacquijacquie
The fact that multiple, completely different answers have lots of upvotes is very, very sad.Menology
Is it possible that if the image is too big and its load time take too much it is discarded from launch screen?Graphemics
@Graphemics I think there is something to that theory. I have a launch view that has a large image and small one, the small one loads fine and the large one doesn't. The small image is in xcassets and the large one I have tried both in and out of the assets file.Conductivity
What solved it for me was just quitting the simulator and running the project again.Stranglehold
Huh! This issue still exists. Hard restarting the device solved it.Carmencita
@Carmencita Did you fix this? one particular image is not displayed in my splash screen.Grose
U
496

After restarting Xcode, cleaning the build and a number of the other suggestions on SO about this problem. What actually fixed it for me was a hard reboot of the device. (I wasted over an hour on this)

I suppose it just goes to show that the old saying have you turned it off and on again is still true for the latest gadgets!

How to reboot iPhone XS or iPhone XS Max

  1. Quickly press and release the Volume Up button
  2. Quickly press and release the Volume Down button
  3. Press and hold the Side Button until the Apple logo appears
Unreel answered 17/3, 2017 at 14:19 Comment(20)
Had the issue of an image not updating after overwriting it in the assets. Thanks for the tip, completely quitting the simulator and restarting it updated the preview. Very odd that nothing else seemed to do the trick.Whitehot
Thanks. It also works for the simulator. After restarting the simulator, the image in the Launch Scree.storyboard finally shows up. It's definitely a bug of iOS.Gratulation
Thank you. What should have taken 5 minutes took about 25. You saved me some time. I did a "Erase all content and settings" on the iPhone X simulator and that fixed it. It installed properly on a physical iPhone.Amontillado
Same problem here. Even I got the image changed on the launchscreen in the simulator, the old image somehow was still cached on my phone. Tried clean build, change file name, change image, didn't work. I had to turn my phone off and on. That fixed it.Atmo
Yep hard reboot of the device is the solution for this in many cases. The weird part for me was that if I changed the image it would work, but when I changed it back to original image it would stop working. Overwriting the original image did not help. Hard reboot fixes it. Weird bug for sure.Vientiane
I restarted the Device and xcode, clean the build and it worked for me.Gothard
This is just beyond my comprehension that after eleven major releases of Xcode and thirteen major releases of iOS we have to deal with such preposterous issues...Lycopodium
Apparently, iOS caches the startup screen "outside the app" so that as soon as you touch the icon it can pull from this cache to give immediate response. I had a situation where both my previous launch screen and the new one showed up (in that order). The old launch screen must have been pulling from the cache, the new launch screen was pulled from the app. After rebooting, the old screen no longer appeared. This should help explain why a device hard-reset (reboot) is required.Finnish
Xcode 12.5, May 2021: yup, this was the magic trick for me, too. Having the company logo actually appear in the launch screen seemed like a good idea, you know? Thanks!Rheinlander
2021 and this bug is still here. After wasting 3 hours on this issue this answer saved me.Bunder
How has this issue existed 4+ years!?Catchpenny
This worked for me. + Deleting the app and re-installing again.Carmelcarmela
Still helpful in 2022. Also, if you're using Simulator, erasing all content and settings doesn't work. You have to run it in different "simulator device"... Spent 2 hours on this crapPaedogenesis
September 2022 - This is still a problem and this is the solution. I spent almost an hour trying to change picture to png, svg, renaming etc. Nothing worked, but this answer did the trick. Thank you!Encephalo
2022 and it still work like a charmTimberwork
yesterday it worked for me, today with new image hard reboot doesn't workSeaddon
2023 bug still here, fixed with rebootIatric
.... and still the same bug .... reboot will do :-( Apple is great ironic :-)Signorelli
Rebooting iPhone 15 Pro was the solution as well. For good measure, I restarted Xcode and deleted the app, and did a clean build folder before trying. There should be a counter of how many hours of peoples lives were collectively lost to this insanely great platform.Jagir
February 2024 and this fix still works.Rheinlander
M
138

I was messing around with this for hours too. But i found the solution now. You need to add the image to your project and also to the assets.xcassets via drag and drop.

Merchant answered 9/12, 2016 at 14:18 Comment(14)
This was it. Image had to be in both project and assets. This is like a game of whack-a-mole. Which tip will fix it? nobody knows.Schmaltz
who knew that you have to add image in project tooPerdition
Thank you! This works. For me, I don't have to add the image to the assets, only to the project.Hamon
Adding image just to the project fixed my issue :)Afield
@user924 no one said he forgot to add the image. You have to read better before start insulting. I noticed that you have to add the image both in project and assets if you want more than one image, if you have only one you can add it only to the project.Fraternity
@user924 we all add it to assets, but sometimes launchscreen cannot read images from assets until you delete your app (maybe only in debug but you can't be sure), so you have to put them in the project directory and in the assets too. It isn't good practice to keep all your images in project directory and not inside the assets except in this case.Fraternity
this is a pretty silly "bug" in xcode, Hours of stress and such a simple answer. This should be acceptedAmino
Thank you, this sorted it for me. To add to this, I had previously named the images with the size (launch280.png, launch560.png, launch840.png) and also added an asset to Assets.xcassets with asset name of launch. But it still didn't work. I had to rename the image files to launch.png, [email protected] and [email protected], add them to the project, add them as an asset called launch, and then it worked. Thanks Apple for making the simplest of things needlessly complex ¬_¬Matland
Only this solution works for me in 2020. Tested on VS for Mac 2019 - Xamarin.iOSEstep
This answer worked for me even with LaunchScreen.storyboard. Image has to be added separately to project and target AND in Image.xcasset, AND referenced in the storyboard.Glair
Aaaand I'm here for the second time 3 years later... It's April 2020, XCode still has this bug... Nice...Schmaltz
Exact the image needs to be in the Assets and Textures foldersBonney
Seems like this is helping a lot of people but as of XCode 12.3 at least, this duplication of the image is not necessary (see Flexicoder's highly upvoted answer). I have images only in xcassets and they DO appear on the launch screen. However after making changes sometimes a restart of device and/or XCode is required.Assonance
July 2021 now, this still helps. Thanks!Doubledecker
K
63

Had the same issue, adding the image to the "Build Phases -> Copy Bundle Resources" fixed it for me.

Kalbli answered 18/10, 2017 at 13:8 Comment(2)
This is what I needed. The image must be in the main bundle not in the assets file.Hairsplitter
yep did it for me.Nerissanerita
S
36

Follow below steps,

  1. Remove application from the device
  2. Restart device
  3. Build again

If not working, delete derived data. Xcode Preference->Locationtab->Derived data. Then do follow above steps.

Southeast answered 5/4, 2018 at 7:43 Comment(0)
S
30

It happened to me and makes me crazy, beyond get me lose some minutes 'til I figure it out.

So, like was said before:

  1. Import the desired image to your Xcode project (just drag and drop it)
  2. Change its Constraints and Alignment
  3. Update frames resolving Auto Layout issues
  4. In the Attributes inspector tab menu (generally in right corner menu xCode), on Image view > Image, remove image extension (.png or .jpg) - that's the trick

On the design screen, it will not appear, but when you run your app, it will be shown.

I hope it can help!

Sancha answered 21/6, 2016 at 18:17 Comment(2)
worked for me! before trying your solution the only way i got it to show was restarting my phone! Thank youHendren
Yes indeed!! The trick is to remove the image extension from .png image files! .jpg files didn't work so i had to convert them to .png first! Thanks a lot Jhnosore!Spirelet
C
29

Very frustrating. Solution that finally worked:

  1. Do hard reboot of device

  2. Delete app

  3. Install app from Xcode

Chagres answered 23/9, 2017 at 2:14 Comment(0)
L
27

At last, restart the phone works for me!!

I have spent hours on this issue. Had tried change the images name, delete the whole image assets, modify info.plist, restart Xcode and even tried to set all the attributes of the images(which you can tell how desperate I was).

Lavolta answered 19/7, 2018 at 11:5 Comment(6)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewInflated
Im sorry @AdamRichardson it provides an answer and a correct one too and this was my case. I just needed to just RESTART the phone/simulator.Nye
I spent 16 hours trying to resolve this and finally restarting the phone made the trick.Dwight
I bet someone at Apple that could fix this must be thinking: "Oh, they just need to restart their phones - it's not like this affects Release builds or anything. We can leave this task for later."Pupiparous
Ultimately it ended up being reboot the phone that fixed the issueVin
We're in the middle of 2023, and we have still to restart the iPhone... Thanks btw!Flophouse
J
19

After invested a lot of time, I got the solution:-

Step 1:- Quit Xcode
Step 2:- Delete the app from device/simulator
Step 3:- Restart your device (if you are using simulator then you have to quit simulator)
Step 4:- Clear all derived data 
Step 5:- Clear Bin
Step 6:- Open Xcode and relaunch the app, it will work 
Jadejaded answered 6/5, 2020 at 11:48 Comment(0)
V
18

I faced the same problem.

  1. Add an new imageset to XcodeAssets.
  2. Add images to to the imageset.
  3. Add image view to launch screen and set your imageset as image
  4. On Imageview's attributes inspector, uncheck 'clears graphics context'
  5. Clean the build folder and run again.

enter image description here

Vaduz answered 30/9, 2017 at 11:39 Comment(3)
thank you, super duper thank you. i always came back to your comment. this driving me crazy. and your fix is working for me.Prow
uncheck 'clears graphics context' helped me!Antecede
I had to delete the app and restart my phone in addition to these steps, but it worked. thanks manMidshipmite
H
16

This issue is related to the Assets.xcassets to fix it you must add the image as resource but not in the xcassets folder and then should work just fine

Heyes answered 21/5, 2018 at 13:14 Comment(2)
This is the only solution worked so far. Restarting xcode, clearing derived data, changing image name didn't work. I don't recommend restart device as a solution to anyoneBallonet
this bug is as old as the creation of xcassets. I have filled it mentally on my folder "stuff apple will never solve".Epic
L
9

In my case, resetting content and settings for simulator fixed the problem.

Lacrosse answered 2/5, 2017 at 4:50 Comment(0)
F
8

After trying everything on several StackOverflow threads, here's what worked for me:

  • Use a .png
  • Do not include it in your Assets catalog. Add it to your project's hierarchy directly, as you would add any source file.
  • In the image view, load the image including its extension. Example: launch_app_image.png

(Might have to clean product or derived data to update, but I didn't have to)

Fang answered 21/7, 2018 at 10:28 Comment(2)
2020 and this is still relevant, sometimes changing the image to a new PNG inside the catalogue when it works will stop it. Unsure if it's a compression level thing but plain image files works.Aleph
Tried all the hints explained above - nothing worked but the .png file. Thx Kqtr!Cotswolds
G
5

It seems there is some problem with resource caching in xCode. Had the same problem, restarted xCode and everything works fine after that.

George answered 10/2, 2017 at 13:46 Comment(1)
Just had to disassemble my Mac, then assemble it again. Done same thing for the iPhone. Camera, everything. Works like a charm.Plug
V
5

Restart your device and clear x-code derived data

Vasculum answered 27/7, 2018 at 9:32 Comment(0)
T
5

Importing images as regular files worked for me. Don't add image from assets catalog!

enter image description here

enter image description here

Tait answered 5/8, 2021 at 17:16 Comment(4)
So I found this happening and I too think it has something to do with the @ images. I removed the @2 and @3 and bingo it now shows up!Bake
After 8 hours of head-meets-brick-wall, I reimported the .png images as regular files (under Supporting Files). iOS was happy to display other jpegs, Apple SVGs and miscellaneous PNGs but not the client logo, regardless of filename, file format, size, colours, clean build + delete from device, restart Xcode, or any other solution above. Would love to know what I missed. (I've been working with iOS for more than ten years. Maybe just a bad day.)Overelaborate
@AndrewKingdom can't tell what could go wrong... try renaming it, resaving as jpeg (to test) and then maybe resizing/resaving it as a new PNGTait
Renaming it didn't work, re-export as a different size didn't work. Weirdest thing I've ever seen. I'm guessing it's either some very obscure bug in Xcode or some corruption of the project. Thanks for the suggestion though.Overelaborate
S
4

Was changing the background image of the splash screen and the new image wasn't showing (react native project).

Following the answers from others.

I did all the below and it was fixed:

  • Clean build.
  • Remove app from simulator
  • Quit simulator
  • Restart XCode
  • Run app again
Seringa answered 5/11, 2018 at 7:55 Comment(0)
K
4

Actually, for some heavyweight images, it isn't a good situation to add them into images.xcassets, because the app loads images.xcassets lightweight images before launch. So I put splash screen images at the first root of load and then the issue has gone:

  1. Create a new Group in the root of the project
  2. Drag and drop your image inside of the yellow group folder
  3. Rename it to a different special name
  4. Back to your xib (or storyboard) file and address the ImageView to the special name that it is in step 3.
  5. Clean and build again, then you can see your image.

Hint: You can create your ImageSet in the images.xcassets but place them in the root of the project.

Kartis answered 11/11, 2020 at 14:25 Comment(0)
G
3

Well As of now there is retina device available and I ignored @1x image in Assets.xcassets.

In my case, I have app logo in Splash screen which is not visible when I run the application.

After wasting so much time I figured out that I only provided @2x and @3x images for that logo image.

This issue is resolved by adding @1x version of that image.

Gallous answered 10/1, 2018 at 6:48 Comment(0)
C
3

I had that problem after adding image to project and shotdown the device the problem solved

Cato answered 19/8, 2018 at 14:26 Comment(0)
D
3

In my particular case, the splash screen worked for the simulator and other devices, but stopped working for one specific device. This lead me to believe that it was some caching data kept by xcode (v10 and iPhone 7 v12.1).

I deleted the derived data at: ~/Library/Developer/Xcode/DerivedData/ only emptying the folder contents, not deleting the folder. I then rebooted the mac and the iPhone and cleaned and rebuilt the project, and now it is showing up.

I'm not sure if all of this was necessary, but didn't want to waste any more time narrowing it down, so the above sledgehammer approach worked for me. But of course it always depends on your specific situation - mine was device specific; for others it could be the actual image or launch screen layout etc.

Downpipe answered 12/12, 2018 at 23:18 Comment(0)
A
2

You have to make sure that the file name of your image has a format like .png or .jpg at the end otherwise it will not work. Also, before adding your image, you have to make sure that the image file is in your "Assets.xcassets" folder within your project. This can be done with a simple drag and drop. Also, make sure when you've added your image to your storyboard that the image name in the top left also matches the real image file name. I would try looking into Constraints too. Hope this helps. Good luck with your App.

Abbyabbye answered 18/4, 2016 at 0:19 Comment(0)
S
2

I tried so many things with this (this thread alone seems to have a million ideas and half of them are conflicting). The problem for me was that when I did things like restarting the device and Xcode, it would cause the image to show for a few sessions of the app, and then it would stop (I have no idea why, but WOW it was annoying).

After countless hours, I found that A.G.'s answer in this thread is the correct one. The one thing I was doing wrong was that I was creating a new image set within xcassets, but I was then still using the name of the image within the UIImageView inside of the storyboard instead of using the name of the image set.

To clarify, what you would do is create a new image set and name it something like "Launch-Defaults", and then add your images to it. Then, within the UIImageView inside of the storyboard, you use the image "Launch-Default" (not including an extension since there is none since this is an image set).

When you do all of that, the image should actually appear correctly inside of your storyboard. Some people say the image will display blank if you don't use the extension (.jpg or .png), but I assume that is because they are not using the name of the image set. Others say you need to use an extension like .png or .jpg, but the key is to create the image set inside of xcassets and then use that image set inside of the storyboard. When done correctly, there should be no funkiness like an image not showing up or the Launch Screen only working some of the time (requiring a reboot).

Scandalize answered 26/11, 2018 at 20:45 Comment(0)
R
2

Just to add my $0.02 to this question; I got this solved by using PNG images instead of JPG/JPEG images.

After converting the images to PNG and crunching them to reduce the size a little, everything worked fine.

Redstart answered 3/12, 2018 at 8:51 Comment(0)
S
2

In my case, it was a bit more than just rebooting the device. My launch image was stored in other Assets (Other Pods).

Had to move the image to App project's Assets. And then rebooted my device. (Check simulator first, it should work). Then it worked.

Images can be in format png/pdf, single scale or not doesn't matter.

Solute answered 12/6, 2019 at 6:57 Comment(0)
G
2

My issue.

Reason: I have renamed the images after dragging into Xcode. Solution: Don't rename images after dragging into Xcode. It creates problems for understanding Xcode. Rename images before dragging/adding into Xcode.

Hope it helps you out!

Gmur answered 21/8, 2019 at 6:2 Comment(0)
W
2

I was stucked into same issue thanks to the below reference I am able to resolve the issue

https://developer.apple.com/forums/thread/19759?answerId=75438022#75438022

Though it is not necessary to change the image name and removing the extension while selecting the image for imageview, I simply created one folder named resources and added my image inside that folder coz I thought it would be not good to put images directly into the root folder

Hope this would help.

Happy Debugging!

Weber answered 27/12, 2022 at 8:24 Comment(0)
I
1

I spent hours on this problem before finally realizing my mistake. When you add an image to a UIImageView, it will use just the name of the image. If your images are in a different folder than your storyboard, they will show up in xcode but not when running the app. You must add the appropriate file path prefix, for example, images/image.png. It will now appear as a blue question mark in xcode, but it will work in the app.

Indigent answered 25/8, 2016 at 22:57 Comment(0)
A
1

I faced the same issue. Tried different solutions for that but nothing proved to be helpful. I then realised that the image was not visible only when i directly installed the app into device and the app is still connected to the xcode. If i disconnect it and then open the app the image was visible as expected. It might be a xcode bug.

Arsine answered 17/5, 2018 at 11:44 Comment(0)
A
1

I tried cleaning the project, removing the png, removing the constraints did not work for me.

I just made one more copy of the image and renamed the copy then deleted the old image and added the new image (Same, with name changed) i just gave that image and it worked for me.

Also i am not using the Assets.xcassets, using the image in a folder.

Ache answered 3/7, 2018 at 15:27 Comment(0)
D
1

My first mistake was, that I created a normal .storyboard, renamed it and defined it as launchscreen in the project settings. I this case I had image problems. It seems that some settings are missing in this case then, so I just created a new file via file->new and picked directly the "Launch Screen" and then it worked.

Also I had in mind that, that layout constraints are not supported in the launchscreen for some reason. Maybe it was like that in the beginning, not sure, but now constraints should work.

Maybe this helps anyone.

Disputable answered 26/3, 2019 at 12:7 Comment(0)
T
1

In my case I could fix it by just unchecking "clears graphics context" from attribute inspector for all of the image views used in the Launchscreen storyboard.

For your information i had imported images in Assets.xcassets in png formats.

Td answered 6/3, 2021 at 4:55 Comment(0)
P
0

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 - see image below:

enter image description here

Pestalozzi answered 24/4, 2017 at 15:54 Comment(0)
D
0

In my case, it turned out I had some views still linked to the view controller that was now just a basic view controller. If I control-click on the view I can see the outlets with warnings, however, the warnings did not appear in Xcode which is why I was having trouble finding them.

Diverting answered 20/9, 2017 at 6:34 Comment(0)
N
0

I have face this same issue when using launch-storyboard for showing splash screen and after research i have found that the image what i have set in launch-storyboard is of different size and i have set image-view bigger than actual size of image.

So the solution i have found is either set image-view content size as aspect fit or set image-view size as image size.

Like if your image @1x size is 200X200 than image view should be of 200X200 than you will solve this issue.

As because if you set image-view size bigger than image then image will starched and this is not allowed.

If you still have any doubt please comment here and ask

Nubbin answered 16/5, 2019 at 5:16 Comment(0)
H
0

I had launch screen file named but it didn't exist. When I removed this my launch image appeared.

Hubey answered 20/11, 2019 at 15:24 Comment(0)
V
0

In my case I had to select two checkmarks:

  • Use as Launch Screen
  • Is Initial View Controller

Use as Launch Screen

enter image description here

Veraveracious answered 4/8, 2021 at 7:6 Comment(0)
Z
0

There was 2 issues in my case that resolved it:

  1. It seems there is a 1MB size limit for the image; not documented but when I optimized the same image from 3MB to under 1MB it worked. This would make sense since the OS wants the launch screen to be light as possible.
  2. The OS does indeed cache the launch screen aggressively! To see my launch screen changes, I had to reset the simulator each time: Device > Erase All Content and Settings
Zook answered 13/8, 2022 at 11:47 Comment(0)
B
-1

This happens to be a caching issue in XCode/iOS, but there's a simple fix to this: Just rename the file inside Assets.xcassets, so the cache gets regenerated.

Briony answered 12/5, 2018 at 9:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.