Not able to set Launch Image in iOS - ios

I am a newbie in iOS. I want to set Launch Image in my app. And I'm using Asset Catalog. And I know I have to drag and drop the image to the boxes that shows up when I'm using Asset Catalog. But a weird thing which is happening at that time is when I'm trying to drag-drop, it just comes back . As if Xcode is telling me NO PLACE HERE. Xcode doesn't let me set my Launch Images. I'm not able to DROP my images in those boxes. And I know the sizes of my images are quite correct. 640*960, 640*1136, 750*1334, 1242*2208.(And I don't want to use LaunchScreen because it only supports iOS 8 and later.)
It's even more weird that people are down voting without even telling the reason. (If you are not good enough to help at least don't discourage newbies)

Got the solution.
Just answering my question so that if anyone is having same problem then here is the solution. My problem was because by mistake I was using images of "jpg" format where in fact I should have used "png" . Now I'm using "png" and it works perfect.

Click on images.xcassets. You should see app icon in the list. At the bottom of that column there is a plus and minus button. Click the plus button.
Click on new Launch Image in the list. This covers iPad's and iPhone's from iOS 5-8 and covers portrait and landscape.

Launch screen can also be support for ios 8,
What you need to do set the Go to project->Media.xcassets on right side information tab you need to select iOS 7.0 and later sizes.
Then you set your launch screen inside the Launch images.
It will work definitely.

By apple provide the document Adding an iOS App Icon Set or Launch Image Set
Thanks

open Images.xcassets of your project
Drag file one by one on boxes as per its size.
See following image.
After doing all Remove LaunchScreen.xib file from your project
And remove Launch screen interface file base name from your plist file.

Related

Launch Screen not working on iOS 14 with Xcode 12

I am very frustrated now. I upgraded Xcode to version 12 and tested my app on iOS 14. Now the problem is, that my launch screen is just showing in black. I tested it with an iOS 13.5 device and it is still working as expected. I tried to remove the launchscreen.storyboard approach and added the Launch Screen key in the info.plist, but then the image is scaled to full size.
Now I tested a little bit with the launchscreen.storyboard and I found a few things.
If I remove the Image view, the launch screen is showing as expected. I added just a label and that would work.
If I use an image from the system in the image view, it is working as well. It is just not working when I am using an image from the project.
Did you experience issues with iOS 14 and the storyboard approach?
If yes, how did you fix it?
A work around that seems to be working for me:
For a strange reason if I am downsizing the image then it is working fine. I had a full size image of dimension 2732x2732 and it didn't work. Reducing the dimension of the same image to 2400x2400 is working fine. I have tried with 2500x2500 and 2600x2600 but none worked.
Most importantly, every time I change the image I had to restart the simulator to reflect the updated image.
It didn't work on the real device yet. Like the simulator, I had to restart the device and then only it worked.
Not sure if it is something with the dimension/size of the image or with the reboot.
Further updates:
I uploaded the same build (with smaller image) to TestFlight and installed it on my device (basically updated from the previous version having large size image) and unfortunately the issue persisted :(
Now what I did is uninstalled the app and reinstalled it again from TestFlight. Issue still persisted.
Finally I had to delete the app, reboot my device and install the app again. This is when it worked fine.
So here are a lot of good ideas, but I was able to finally solve the issue - it is more like a workaround. I needed to store the picture outside the Images.xcassets folder and then it started to work again. This is a very weird issue.
A workaround is to use a button with an image instead of an imageview in the launch storyboard. It works like a charm!!
One reason might be the size of the images. Since iOS 14 images for launch screen are limited to 25 MB as stated in Apples Human Interface Guidelines.
An image with 2.400x2.400 pixel will result in a memory size about 22 MB. With 2.500x2.500 we reach the 25 MB.
We had the same problem where the full screen image in LaunchScreen.storyboard was black on all #3x devices like iPhone 12. Reducing the size of only the #3x launch image from 3.072x3.072 to 2.400x2.400 solved this problem.
A square image is the easy way to support landscape and portrait orientation. But it should also work to have different images for each orientation, where one image in total is less than 25 MB.
Had the same problem. The issue was the .png image used in the launch screen storyboard. This lead to the whole launch screen just being black.
What fixed it in our case was:
Choose a smaller image
Delete App from device/simulator
Restart device/simulator
I found that the image was the source of error by replacing the image with an other one in our app. It immediately worked with a different image (no restarting or else required).
The only workaround that works for me was to add the images outside Images.xcassets folder. After modified this and rebuild the app, it worked expected.
Some issue it's happening on the iOS 14 or XCode 12.
I encountered this problem
when using LaunchScreen.storyboard and used the image on Assets.xcassets, not working on iOS 14 with Xcode 12.
I solved it by try put change 3x image 2436×1125,and set 2x image 828×1792.
Finally I had to delete the app, reboot my device and install the app again. This is when it worked fine.
I had this, too. Pretty infuriating. My launch screen is merely a background image (2048x2048 PNG) and a graphic (2048x2048 PNG) in the middle.
The fix for me was to have a smaller middle graphic (720x720 PNG), remove the images from any assets catalogs, and add them into the project.
The images didn't show on the Simulator until I restarted it. When built and installed to my iPhone, I didn't have to restart it.
In my case, the ViewController property, "Is Initial View Controller" was not checked. Also, be sure to set the color of the view to an actual color and not a system color, otherwise you can run into issues with the device theme settings. That is, if you like to show a specific color.
Also, to access that setting make sure you click on the actual View Controller object in the drop down panel.
The only thing that worked for me was:
Delete the existing LaunchScreen.storyboard & create a new one
Check " Use as Launch Screen "
Check " Is Initial View Controller "
Make sure the image your using is NOT located under Assets.xcassets folder. I put my image in the root of the project
Delete the app, restart the simulator, and run the application
BINGO!!!
I have a similar issue with XCode12 / iOS14 and React project:
The launchscreen.storyboard was working fine in previous versions. Since update to XCode12 it shows as following:
Lauching into a black screen (2-3 seconds)
Then showing the Launchscreen correctly
If I try to use the new "Launch Screen" dictionary in Info.plist I have the follwing issues (same in another Xamarin App):
Image is zoomed in / not showing completely
Background color setting is completely ignored (tried RGB and Color.xcasset)
This is just completely bugged since Xcode 12 !
So I've had this bugged with Apple via their feedback system since June 26th 2020 - FB7795777.
I've provided my project and many diagnostic reports and they've never come back with a fix.
However, today, I fixed it.
Basically, there has been some change in the iOS/iPadOS SDK about how it's support .PNG and .JPG files (size or dimensions are the problems I think) in the Launch screen process.
The solution:
Open your .PNG file in Photoshop and re-export it with the 'Smaller File - 8-bit' option checked. It shrunk it down to less than half the size, and it worked first time.
In my case following did the job:-
Remove Launch screen file from Project -> General -> App Icons and Launch Imagees -> Launch screen file.
Go to info.plist file and open as source code.
Add following code there and change the image name:-
<key>UILaunchScreen</key> <dict> <key>UIImageName</key> <string>splash(This is your image name)</string> </dict>
In iOS 14 this new key was released (UILaunchScreen). So take care from next time. If you get error then check info.plist file.
Happy coding :)
That worked for me was:
Put xxx.pdf image into Assets.xcassets and set "scale" to Single Scale
In Launch Screen.storyboard, set the imageView's image is xxx, then set imageView's width, height, centerX and Bottom to View
Then worked for me
Xcode 12.5.1, iPhone 7 Plus, iOS 14.6
In my own case , I solved the problem in these few steps:
Image must be 1024px, then
Add to assets
-> A workaround in case you have a much bigger image, use these simple steps:
Generate your app icon
Go to the app icon folder
Copy the 1024 px of that image andappicon image
Then add to assets.
Both methods works perfectly.
This may help others so I am adding it here.
I use Cordova for my hybrid app, and then I load my image assets that are generated by Asset Catalog Creator (which is a great little product).
This was working perfectly until I updated to Xcode 12 and tried to run it under iOS 14.
What I discovered is that Cordova was adding a "CDVLaunchScreen.storyboard", and they had a "LaunchStoryboard.imageset" (directory) in their asset catalog, which contained just a contents.json file.
I simply copied this into my asset catalog, and when I drag and drop this into my updated project (newly generated each time by Cordova), my Launch Image displays again.
Don't ask my how or why Xcode magically wires this stuff together, but it worked for me.
I can pass along the contents.json that worked with my asset catalog if it will help.
BTW, my General settings screen does NOT have a Launch Screen File selected, but Xcode seems to find the required files.
I've got yet another potential solution to this, as none of the existing solutions worked for me.
I use PDF vectors in my Asset file, and this normally works great. But it turns out that it doesn't work on the launch screen - it just shows skips the launch screen entirely if it contains a PDF image.
Swapped it for a large PNG, problem solved.
What worked for me:
Use smaller images like #Darkpaw suggested. Launch storyboards are, after all, intended to be indicative of the coming UI, not artwork based.
Use PNG image (not PDF) and don't put it in an assets catalog like suggested by #Sylber
Just noting separately as I had black/broken launch mages until I did BOTH steps.
You might be seeing this issue if your #1x, #2x, #3x images are blank in your image xcassets folder.
Make sure you have images for each.
You can also select your 1 image, and set Scales as "Single Scale" in the Attributes inspector (on the right hand side)
In Xcode 13 launch screen was not displaying rather a black screen was coming.
But this worked for me Project -> General -> App Icons and Launch Images -> Launch screen file -> change Main to Launchscreen.
Most answers mentioned here are workarounds, the issue i noticed is that when you modify the launch screen assets, do check the item file name too.
Assets -> Show in folder
Then check the launchscreen items folder and make sure that the item inside the folder has the same name as folder.
To expand on Thorsten Stark's answer above...
Since iOS 14 images for launch screen are limited to 25 MB
For me it appeared to be an accumulated size of assets on my Launch Screen storyboard file. When I removed a number of them I no longer saw the black screen.
I ended up just using one image 2778 x 1284 which was 600kb in size. This solved the problem.
To further test, I duplicated the image to make 3 copies on my Launch Screen storyboard file, and sure enough, black screen again.
The best solution to me in 2022...
reduce sizes of your images, in my case:
splash.png (256x256)
splash#x2.png (512x512)
splash#x3.png (768x768)
only doing this and put them in Resources folder then reference in
ImageView work like charm....
alternative:
use Button in place of ImageView works too

Xcode 7 Launch Screen images dont load properly

I am trying to make some different launch screens with Xcode 7 ios9.1
for different iOS devices (iPhone iPad)
If you take a look at the following images this is what I've done
Here I have made exactly all the images dimensions that it needs and I have filled out all the table with the images. I have made this by right clicking and selecting New iOS Launch Image.
Here I have set the launch images from LaunchImage.
And here is the launch screen storyboard which I have left it empty.
Now, when I run the app, it doesn't load the loading screen.
You need to Remove one String from your project info.Plist File for Launch splash screen.
It's Launch screen interface file base name.
I attach Screenshot for remove String in .plist file
Here you saw second line just remove from Your file
In addition to Maulik Patel`s answer, I found that if you set launch images improperly, maybe you need to delete the app on your iPhone or simulator, set launch images right and rebuild it again. It works for me. Maybe there is still some cache of settings in the app.

Splash screen not visible for iPad, only a black screen gets shown

I have an universal app. The splash screen loads fine for iPhone but the same is not visible on the iPad. Instead a black screen appears in its place. I have gone through the questions posted in this regard and have followed the steps but to no avail. I am using asset catalog in my project. Storyboards have not been used. The names and dimensions of the images used are as follows:
1. Default-Landscape.png (1024x768)
2. Default-Landscape#2x.png (2048x1536)
3. Default-Portrait.png (768x1024)
4. Default-Portrait#2x.png (1536x2048)
5. Default-568h.png (640x1136)
6. Default.png (320x480)
7. Default#2x.png (640x960)
Please let me know if there is anything wrong with the dimensions I am using. The options I have selected for the Attributes Inspector for the Launch image are given in the image below:
Following is the setting for Launch image:
I added the same launch images to a sample app and the launch screen showed up perfectly on iPad.
EDIT:
As per the suggestion of #iphonemaclover, the problem was solved using "You should also remove any other key suffixed with (iPad) or ~ipad." There was a key UILaunchImages~ipad in the plist which I removed. Now the launch screen is properly visible.
Please delete your derived data and clean the your project.
Also reset your simmulater if you running over it.
Hope it will help.
Also check you have selected Universal App in your target setting.
EDIT
You should probably be using an Asset Catalogue for your launch images, which might be what Xcode is expecting. You can see what Xcode is expecting in the General tab for your target:
MORE Suggestion
Q: Why does my app launch to a black screen on iPad?
A: Apps that have been designed only for iPhone may launch to a blank screen when run on an iPad. This is caused by the presence of an empty iPad specific storyboard in the app bundle as well as an iPad specific UIMainStoryboardFile key in the app's Information Property List (Info.plist) file. Both are automatically created by the various Xcode template projects if the Universal option is selected.
...
In Xcode
Look for a file named MainStoryboard_iPad.storyboard in the file navigator. If this file is present, remove it from your project.
In In your app's Information Property List
Look for a key named Main storyboard file base name (iPad) or UIMainStoryboardFile~ipad. If this key is present, remove it. You should also remove any other key suffixed with (iPad) or ~ipad.
Finally, test your app on an iPad or in the iPad simulator and verify that it behaves as expected.
You should add your launch image to your asset catalogue, and make sure the setting shown is configured correctly.
If you don't have one already, you can add an asset catalogue by going to File > New > File, the look under the Resource tab.
Probably not related to most people's problems but I would like to add another possible issue. I had the same problem with my project. I could see my iPad images in X-Code but what I missed was that the title underneath was "unassigned" and not "iPad Portrait" (this was probably because it was a boilerplate React Native project that was initially configured only for iPhone).
After making my app universal, I needed to recreate my LaunchImage set which then had designated placeholders for iPad. I re-added all my images, assigned the new Launch Image set, clean, build and it was fixed. Hopefully it saves someone else some time.
If you're not loading an image in your slash screen do you get the white view? If you're not getting, then your view is not loaded. That is why you're getting a black screen.

iOS how to set app icon and launch images

How do I set the images so that I can archive and validate my app? The screen looks like this now:
So the first one says 29pt, but then it also says 2x. So do I put a 29x29 image or a 58x58 image? And where do I put all of the other ones? (I know that there are more sizes than 29, 40, and 60).
Anyway, what I tried was I dragged a 29x29 png onto the first slot, a 40x40 onto the second, and a 60x60 onto the third and fourth. When I went to Product->Archive, I get
/Users/kendon/Documents/iPhone Apps/Sales Tool/Sales Tool/Images.xcassets: The app icon set named "AppIcon" did not have any applicable content.
I recently found this App called Icon Set Creator in the App Store which is free, without ads, updated on new changes, straight forward and works just fine for every possible icon size in OSX, iOS and WatchOS:
In Icon Set Creator:
Drag your image into the view
Choose your target platform
Export the Icon Set folder
In XCode:
Navigate to the Assets.xcassets Folder
Delete the pre existing AppIcon
Right click -> Import your created Icon-Set as AppIcon and you're done
Update: Unless you love resizing icons one by one, check out Schmoudi's answer. It's just a lot easier.
Icon sizes
Above image from Designing for iOS 9. They are the same for iOS 10.
How to Set the App Icon
Click Assets.xcassets in the Project navigator and then choose AppIcon.
This will give you an empty app icon set.
Now just drag the right sized image (in .png format) from Finder onto every blank in the app set. The app icon should be all set up now.
How to create the right sized images
The image at the very top tells the pixels sizes for for each point size that is required in iOS 9. However, even if I don't get this answer updated for future versions of iOS, you can still figure out the correct pixel sizes using the method below.
Look at how many points (pt) each blank on the empty image set is. If the image is 1x then the pixels are the same as the points. For 2x double the points and 3x triple the points. So, for example, in the first blank above (29pt 2x) you would need a 58x58 pixel image.
You can start with a 1024x1024 pixel image and then downsize it to the correct sizes. You can do it yourself or there are also websites and scripts for getting the right sizes. Do a search for "ios app icon generator" or something similar.
I don't think the names matter as long as you get the dimensions right, but the general naming convention is as follows:
Icon-29.png // 29x29 pixels
Icon-29#2x.png // 58x58 pixels
Icon-29#3x.png // 87x87 pixels
Launch Image
Although you can use an image for the launch screen, consider using a launch screen storyboard file. This will conveniently resize for every size and orientation. Check out this SO answer or the following documentation for help with this.
Useful documentation
App Icon
Launch Screen
The Xcode images in this post were created with Xcode 7.
To save a bit time:
1) You can mark your app icon images all in finder and drag them into your Assets catalog all at once by dragging into one of the empty slots of the app icon imageset. When you hold your drag over the slot, several of the other slots look selected and when you drop those all will be filled up at once. Note that this works in XCode 8 (I haven't tried XCode 7), but in XCode 9 beta not yet.
2) The "Technical Q&A QA1686" apple documentation site has the sizes per app icon slot already calculated for you in a nice image and also contains the correct image names conventions.
I've tried most of the above and a few others and have found https://appicon.co to be the easiest, fastest, and provides the most comprehensive set.
Drag your image onto the screen
Click Generate
Open the file just downloaded to your Downloads folder
Here, you may be able to drag this entire folder into Xcode. If not:
Double-click the Assets.xcassets folder
Select all files
Drag them to Assets.xcassets
Rename it to AppIcon
The correct sizes are as following:
1)58x58
2)80x80
3)120x120
4)180x180
I use a tool called Prepo to produce all the right image sizes. You simply feed the app you image file and it will spit out each necessary file with an appropriate name.
Once you do this, you can then drag in the appropriate files or simply point to your Prepo exported folder.
Now a days is really easy to set app-icon, just go to
https://makeappicon.com/ add your image, they will send you all size of App-icon (Also for watch & itunes as well), now Click Assets.xcassets in the Project navigator and then choose AppIcon. Now you just have to drag n drop the icon as required.
I found App called Iconizer. You can find repository on github. Iconizer can generate app icons for OS X, iPad, iPhone, CarPlay and Apple Watch with just one image.
Simply Drag and Drop your icon onto Iconizer, select the platforms you need and whether or not you want all platforms generated into one asset catalog, then hit export.
After that just replace (delete and import) your AppIcon in the Assets.xcassets
In the left list, right click on "AppIcon" and click on "Open in finder"
A folder with name "AppIcon.appiconset" will open.
Paste all the graphics with required resolution there.
Once done, all those images will be visible in this same screen(one in your screen shot). then drag them to appropriate box.
App icons have been added.
Same process for Launch images.
Launch images through this process are added for iOS 7 and below.
For iOS 8 separate LaunchScreen.xib file is made by default.
I quite like this app made by Jordi Bruin called Bakery
It allows emoji and SFSymbols for quick prototyping (not for the App Store in this case!)
It is as easy as drag and drop your design to the app and then again drag and drop to the asset catalog without having to fill in all the sizes by hand.
This is a very frustrating part of XCode. Like many, I wasted hours on this when I switched to a newer version of xcode (version 8). The solution for me was to open the properties for my project and under the "App Icons and Launch Images" choose the "migrate" option for the icons. This made absolutely no sense to me as I already had all my icons there, but it worked! Unfortunately I now seem to have two copies of my launcher icons in the project though.
As per updated version(Xcode 8.3.3) I saw that below resolution are required for all fields of AppIcon sets.
40x40
58x58
60x60
80x80
87x87
120x120
180x180
It comes with hdpi, xhdpi, xxhdpi etc.
Hope it will helps others.
Edited to 120x120
You can easily do it without resizing yourself or doing anything, just choose your icon at an app store icon generator website
https://getappscreenshots.com/app-icon-generator and it'll generate all required files and all icon sizes so you can just copy the files and paste in your project's folder!
You can get away with just adding a single image of size 1024*1024px.
Just add the image in like so
and select single size in the menu to the right.

Launch Screen not displaying iOS 8

I'm trying to get the Launch screen to display instead I get the default black screen.
I remember I've had this issue in the past and is something really silly but I can't remember what it is.
I have a LaunchScreen.xib. I've set in my target -> info to use LaunchScreen and not image catalog. I am running iOS 8 and using Xcode 6.1. I tried on all iPhone simulators and iPhone 4s.
I can't think what more info to give than that.
For those who are still looking for another answer here's what worked for us:
Our launch xib only contains an imageView in the middle of the view. For some reason the image never showed (but the view was there, checked it with changing the background color).
The solution was to move the image file out of the image catalog and just drop it in the project as a standalone file. Pretty strange considering when we tried other images from the catalog they appeared correctly but not this one. Anyway, I hope this helps someone!
I had the same issue.
Turned out that I had earlier tried to attach a viewcontroller file with the launchscreen. To fix:
Go to launch screen
Click Connections Inspector in right pane
Remove all connections.
Accoring to #doctorBroctor: also go to the File's Owner tab and remove the connections there.
Go to your launch screen
Go to file inspector
Check the checkbox for "Use as Launch Screen"
I have tried with:
Deleted Launch Screen File.
Tapped on Use Asset Catalog in Launch Image Source and added Splash screen Images as desired in the image asset.
Deleted Previous Project on Simulator or Device. Clear the Project.
Run Again and it is showing now.
One reason for why you might experience the black screen instead of your launch screen is that the .xib file might not get copied in your build phase. At least that was my issue that caused my app to show the black screen even though I had done the steps you describe.
So, double check that your LaunchScreen.xib (or whatever it is named) appears in:
Your target -> Build Phases -> Copy Bundle Resources
And if not, make sure to add it. That resolved my issue.
For me the problem was that I hadn't selected the LaunchScreen.storyboard in the General tab of the project settings.
I've experienced the same issue. The solution for me was simply delete the app, reboot the device, then reinstall it. I think iOS caches the Launchscreen, and this cache is not invalidated every time when it should be.
I had the same issue in iOS 9 as well. Deleting the old app in simulator alone is not enough. Simulator has to be quit launched. It worked for me.
I fix it by select the "is Initial View Controller" in storyboard.
Make sure to delete the installed app from the emulator. Then run the app again from xcode (product->clean, product->run).
That worked for me.
I've looked at all the above answers, it helped a bit. Especially the answer by Suragch put me in right direction.
The LaunchScreen.storyboard isn't showing up, even after applying simple background colour to the view and removing the image.
Firstly, I cannot see the "LaunchScreen.storyboard" as shown in the image
This was because, some reason the LaunchScreen.storyboard wasn't added to the build Target.
Solution: Ensure the LaunchScreen.storyboard is included to the build Target.
Also, Choose the LaunchScreen.storyboard from the drop down as shown in above pic.
I hope it helps someone!
I found this old post 'cause my launch screen WAS working, then it stopped. I thrashed around for a good while and then realized this, undocumented problem:
If your launch XIB or storyboard file has a UIImageView with an image whose name contains a space, the entire screen won't load.
I only had a centered UIImageView in my LaunchScreen.xib that contained an image (.png file), and had the same black screen showing.
I removed the image (the .png file) from the project, added it again with new name, and used the new image.
Make sure to use empty Launch Screen File, then Xcode would use Launch Image Source.
Make sure you have "is initial View Controller" checked in interface builder.
I tried pretty much everything else but this finally fixed the problem and now it works in simulator as well as the device.
New feature in the iOS 8 SDK: you can now use a storyboard scene in place of your app’s launch images.
Create a blank storyboard file named LaunchScreen.storyboard.
Go to your target settings and, on the General tab, select the storyboard as your Launch Screen File. Xcode will add a corresponding UILaunchStoryboardName key to your app’s Info.plist. When this key is present, Xcode will prioritize it over any launch images you might have set.
Add a view controller scene to the storyboard. Add some subviews to the scene and position them with constraints. When you launch the app on a device, the OS should use the scene as the launch screen.
For more information check out this blog post by Ole Begemann "Replacing Launch Images With Storyboards".
Reset Simulator working for me
For iOS 14 and newer:
Device > Erase All Contents and Settings...
For iOS 11 and newer:
Hardware > Erase All Contents and Settings...
For previous versions:
Simulator > Reset Content and Settings...
Your launch image should be a PNG. A JPEG may work under certain targets, but you should use PNG anyway.

Resources