Xcode launch images and full screen issues - ios

I'm testing my app on a physical device (using a provisioning profile). The device is an iPad Air 2 with iOS version 8.1.
My App wasn't appearing full screen, so I managed to get it full screen following the advice to add Default-568h#2x.png to the project, as per this thread:
Why [UIScreen mainScreen].bounds] is not returning full screen size?
However, upon adding it to images.xcassets, I see this:
Question 1) Why is Xcode complaining about a Missing Default-568h#2x.png launch image when it's clearly there?
So anyway, this made my app start full screen but the launch image was not appearing. Instead, just a plain black screen was showing up during app load.
Question 2) Why wasn't the launch image showing up?
I deleted all the launch images that were eventually added in an attempt to get something working (because this is iOS and trial and error seems to work way more than a logical process). So at the moment, no launch images exist in images.xcassets. However, my app still runs full screen. I removed the already installed app from the device (by making the icon wiggle and tapping the 'X'), selecting Product>Clean from Xcode and building again. No luck. App still appears full screen on future runs. I then attempted to follow the answer by EliSKoren on this thread:
Launch image doesn't update
However, the only reference I could find to launch images were for simulators, not physical devices.
Question 3) Trying really hard not to loose it ... What's happening!? Why is my app still appearing full screen even though I've removed launch images?

This is because Xcode provides placeholders for different devices and respective to them being retina or non retina and device sizes.
As you can see your image is on a placeholder as "unassigned", So xcode cant figure it out which device it is for, hence the image is not showing.
To correct this here is a screenshot --
EDIT
Please migrate to get the launch image assigned to the assets from here
Click on Launch Image Sources -- Use assets catalogue and the pop up will show and then click on migrate.
As you can see in the attribute inspector, you can choose which device launch image you want and it will give you that.
Check by clicking the place holder what image size or resolution it requires and then you just drag and drop those images from finder.
Hope this helps
Edit Final
As it turned out OP was using cMake for the xcode project and by default xcode had already a launch image asset JSON installed which had a wrong configuration, Thus creating another Launch Image wasnt overriding the existing JSON as for cmake the earlier config was being loaded. And by default Universal devices was selected but the Device orientation was totally unchecked.
Checking device orientation after getting a clean version of the project and letting Xcode decide its default Launch Image assets and filling up images in that JSON fixed the issue with OP. Further discussions are mentioned in the link in the comments.

Related

LaunchScreen.storyboard bug in swift

I was using LaunchScreen.storyboard without problems.
but I changed LaunchScreen.storyboard file name to LaunchScreen2.storyboard since I hoped not to use the splash image.
(I thought it could decrease loading time)
However, I couldn't see the loading time differences.
So I renamed the file to LaunchScreen.storyboard to use splash image again.
But the problem began from here.
Even though I change images in LaunchScreen.Storyboard:-
Only black screen is shown shortly when I run my app on simulators.
Old LaunscScreen.storyboard is shown when I run the app on my iPad.
I took some.. actions but it didn't work.
(use image in Assets.cassettes, make sure Launch Screen File name in project option)
Is there anyone who can help me?
*I attached screenshots
(I'm using the latest Xcode, Version 9.1 (9B55))
I think I found out the root cause of the issue that lasted for more than a month.
At least in my case, the issue was occurred because there was no entry point in the LaunchScreen file.
After entry point was set I could see the LaunchScreen.
This is iOS issue(OS Level) iOS caching LaunchScreen.storyboard image resource and reuse it
why your action did't work because
app on simulators have not cached LaunchScreen so show black screen(LaunchScreen.storyboard not found)
iPad has cached and used LaunchScreen Resource(LaunchScreen.storyboard) so old Resource shown
Common solution is delete app or shut down and on iPhone or iPad for removing cashed resource. iOS mananing this resource in Srpingboard(OS Level) so It is not a complete solution but promotes the cache to be quickly erased from OS. just waiting.. until iOS erase it

UIImageView doesn't show up in LaunchScreen.xib

I have an image set in my asset catalog and I have it set for my UIImageView in my launch screen xib. I know the launch screen shows up because it has a label that is showing when I launch the app on my device. I can see the Image and the label in the interface builder, and even in the simulator, but when I launch the app on my device the image is not there.
Does anyone know what might be causing this, and or have any good ways to troubleshoot?
I have tried quitting xcode, doing a clean, deleting the derived data reset the simulator. I have removed and added the asset I want to show up. I removed and re-did the constraints on the launch screen. I have had no success and it is driving me a bit crazy so any help is much appreciated.
Also I have two different targets so this may be contributing to the problem, but the strange thing at one point in time I did have the uiimageview showing up on the device.
I know what causes this issue, i guess when you first installed your app on your device you did not add image to your launch screen after that you've added the image next time. Right?, iOS picking up an old launch screen so I would suggest you to uninstall your app once and re-run the app.

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.

UIImageView missing images in Launch Screen on device

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.
Turn it 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
"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
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
Hope this help !
The following sequence of operations fixed the issue for me on Xcode 7.3.1 and iOS 9.3.4:
Clean Your Build (⌘+⇧+K)
Close Xcode
Hard Reset iOS Device (Power + Home Button reboot)
Relaunch Xcode - let indexing finish and build on device once it is ready.
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:
(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
reference that image in your UIImageView object in the Launch
Screen Storyboard file...
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.
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;
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.
What worked for me was to select Reset Content and Settings... from the Simulator menu
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.
Have you tried turning the device off and on again? Do it.
Bring images out of Image.xcassets and add them again to project. It worked for me.
Remove app from mobile and then restart mobile and install app again. now the issues will be solved
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.
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)
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.
I think launchscreen only support image in Assets.xcassets.
Restarting Xcode did it for me.
What did not do it:
Clean build folder
Restart device or simulator (image wasn't visible on either)
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.
It seemed a bug of iOS. Like sometimes the system animation disappeared.
Now I just reboot the iPhone and it is worked for me.
In my case I it was the image name.
I added an image named Default-568h#2x.png 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.
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.
Also can 1. delete project image 2. change image name 3. add file image to project
It worked for me.
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.
I experience the same. I change image resolution from 300 pixels/inch, change it to 72. It works for me.
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!
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.
This is too important
Must be empty! Launch Screen File
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..
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 :)

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.

Resources