I am working on a Xamarin.iOS app. We have an issue where our LaunchScreen sometimes do not load the image we are displaying in it. The bug is very transient and it only happens sometimes to certain users.
The thing is that when the image first is loaded on a device, it always shows up. On the other hand, if the image is not shown on a device, you can restart the app several times without it being loaded. Sometimes it helps to reboot the device. Sometimes an update/reinstall fixes it, sometimes it does not.
The image resource we are loading is not included as a On-Demand bundle resource, but is included in an Asset catalog.
I have been struggling with this bug for a while now. Sometimes I think I have fixed it, but then it suddenly shows up again.
I do see my launch screen being loaded, since the background color I have on it is displayed. It is only the image I am having the issue with.
I've seen this post, but it doesn't seem to be the same issue, as what I'm experiencing is in the production build from the app store. In debug builds, the splashscreen is loaded fine every time
UIImageView missing images in Launch Screen on device
Anybody who can point into the direction I should look at? I can share some code for the xib launch screen or the asset catalog's json file if necessary.
Related
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
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.
First of all this question has nothing to do with other similar questions on SO because this problem involves using LaunchScreen.storyboard and the solutions presented on SO don't solve this problem.
I am using an image inside LaunchScreen.storyboard. I change that image and every time the app starts it shows the old image. Things I have tried:
Name the image differently every time
Delete de DerivedData contents
Move the image from the Assets file to the outside
Product > Clean
Delete the app from the device.
Do all 1-4 plus quit and restart Xcode.
It is amazing but nothing works. I have tried everything except voodoo.
The techniques above seem to work for images used elsewhere but not for images used by LaunchScreen.storyboard.
I am running it on the device.
Any ideas?
The likely problem is that Springboard caches the launch image by bundle ID. To force a rebuild, the necessary steps are
Delete app from device.
Restart device.
Install and run app.
However, there does appear to be a so far undefined complete failure case. If the above brute force method fails to work, take a look at this Radar filing: UIImageView missing images in Launch Screen on device which appears to describe a permanent caching failure. In that case, changing your bundle ID and seeing if the expected image shows up is about all you've got left.
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.
I'm building an iPad app using Xcode 4.5.2, and recently the startup image has become truncated -- the bottom half of the image is missing, and in its place there's just a black background. The problem appears to be with the startup images (i.e. Default.png, Default-Portrait~ipad.png, and their #2x counterparts), although when I view them either in Xcode or in Preview they seem to be okay. The reason I think that the problem is with the images is that I also have a view controller that used the same Default.png image as in an image view, and the image appeared truncated there too; when I copied the image in Preview, saved it to a new file, and set the new file as the background image in my view controller, the problem disappeared.
Another important detail: the problem only appears on the device. Everything looks fine in the simulator. I suspected the #2x files, so I removed those from the project, but I still get a truncated startup image.
What's going on here? Seems like a case of file corruption, but I hate to dismiss it without knowing how it happened.
Replacing the default images with a fresh copy resolved the immediate issue for me, and I'd recommend that anyone else experiencing similar symptoms try that. I'm still not clear on how the original images caused the problem, though.