iOS Keeping old launch screen and app icon after update
Asked Answered
ios
P

28

232

I have an app where I recently replaced the launch images and app icons, I removed all of the old assets from everywhere in the project. When I upgrade the app from the old version to the new version by just building in Xcode, everything is fine. However, if I have the old version of my app installed then upgrade it from TestFlight, every time I kill the app then restart it the old launch image briefly appears before showing the new launch image. Similarly when I then close the app, the old app icon briefly flashes before switching back to my new one.

I opened up the App using iExplorer and noticed that there is an image of the old launch screen saved in the /Library/Caches/Shapshots directory (I don't know how or why it got there). When I delete it manually through iExplorer, it stops appearing. However, when I try to remove it with code using NSFileManager methods, I get errors saying I am forbidden from deleting files in this directory.

Has anyone experienced this before and have any advice?

Pantomimist answered 7/10, 2015 at 21:37 Comment(1)
Same problem, and with launch screens the new launch screen never shows, it is using the cached image of the previous version.Whitelivered
W
431

I have been able to reliably get the springboard cache cleared for testing launch image changes by doing this:

  1. Delete your app from the device
  2. Power down the device
  3. Power up device, install and launch app.

The image updates properly every time. It's a shame I need to power down the device to get it to go, but at least I have been able to make progress this way.

In case of the simulator, just restarting of simulator should work.

Wavelet answered 3/3, 2016 at 21:8 Comment(12)
This is the only one solution that worked for me. Thank You very much!Beisel
That behaviour of the springboard is one piece of black magic. Thank you Sir!Phlegmatic
Works for emulator too.Inrush
Good but if we don't want to loose hour previous data, it's an issue to delete the appOutsmart
Is this also the fix for the TestFlight? updating the app from TestFlight also caches the launch images. are you sure this will not happen on the app version unlike the testflight?Youmans
This worked for me as well. Strange that cleaning my build folder & deleting the app from my simulator didn't update the launch screen images, but restarting simulator did????Ermey
this might be the stupitest bug i ve ever seenJedlicka
For the launch screen, I've found that changing the image asset name makes Springboard re-cache the image thereby updating it for your users in both dev and prod.Lp
Deleting, Restarting and installing the app again works if the image name is same. If you change the name of the image and refrenece, then I am seeing the white screen.Thurman
I agree with @EFE. It's still happening in 2020. This fixes it but if all other icons can be updated without doing this, splash icon can too! WTF Apple?Brott
Shame on Apple, still needed to shutdown simulator now in 2021. Thank you because deleting app and clearing build folder did not helped me only to shutdown simulator.Huck
This work for me! It is a shame that you need to turn off and on the phone to make it run. Shame on you Apple and Xcode team.Eratosthenes
H
68

These caches are used by Springboard to make app switching fast. This isn't a problem that will affect your production users and should in theory go away the next time Springboard decides to snapshot your app.

That being said, this isn't a problem you can fix. This is a bug in Apple's code not yours.

UPDATE: There appears to be a work around that doesn't require restarting the device.

This will take effect after the second launch!

do {
   try FileManager.default.removeItem(atPath: NSHomeDirectory()+"/Library/SplashBoard")
} catch {
   print("Failed to delete launch screen cache: \(error)")
}

A full explanation of how that works here: https://www.rambo.codes/posts/2019-12-09-clearing-your-apps-launch-screen-cache-on-ios

Horaciohorae answered 7/10, 2015 at 22:41 Comment(6)
Can you please link to documentation that would confirm your statement "This isn't a problem that will affect your production users"? I have the exact same problem, I am OK if this is dev only but I won't take the chance without official documentation that clearly states what you say.Whitelivered
For some people am getting this for App Store update also :(.Amoroso
Unfortunately I can confirm this problem affects even production users (so after upgrading the app from App Store).Unwilling
Yes it does affect production builds/ App Store builds.Autostability
Any source for this?Adversity
this worked for me..i am deleting it single time based on preference stored, if you want to check ,what other items are there in folder. NSLog(@"%@",[[NSFileManager defaultManager] subpathsAtPath:NSHomeDirectory()]);Anglin
M
34

For the simulator just Reset Contents and Settings...

Mineralize answered 1/5, 2016 at 21:29 Comment(1)
This is not a question. The point is that when deploying a new app with new icons or images, they are not all refreshed the same way and some are kept on display while they have been removed.Err
E
21

This worked for me: http://arsenkin.com/launch_screen_image_cache.html

Again, thanks to the thread I have referenced above I found a way to solve this issue - name your new image differently from the one there was before in case your new one has the same name as the old one and put it out of the *.xcassets folder to the project directory and reference it in your UIImageView. And that's it. Sound stupid easy but oh gawd how much rage I had.

Encode answered 8/8, 2018 at 22:35 Comment(5)
The key here is to keep those images out of the assets catalog. Thanks!Cammi
This solution really helps if you care about your production user's good UX and want to avoid that ugly transition between the old and the new image.Cammi
finally, A solution that actually works! The key here is to put the images out of the assets folder.Hausner
Works perfectly without restarting or deleting the app.Paperhanger
Weird. But the background image I moved out from the assets catalog sometimes is not loading and I get the black background. Now I need to debug it again, but I have no idea how to reproduce unfortunately.Cammi
B
14

I found workaround solution what if you really want to fix this issue. Apple have some mechanisms to cache images of launch screen which indexing by image file name.

When you change any images on launch screen and you want to see those change in next run immediately. please using new image name which image you changed and link to new image file in storyboard or xib.

Run again, you will see new change appear.

Bascom answered 20/10, 2016 at 5:56 Comment(4)
I didn't want to delete the app so I tried this one. This plus restarting my device worked for me.Mineralize
This didn't work for me. Restarting the devide also didn't work... I give up now.Lyall
Didn't work for me. I even removed the imageView and created a new one with the new image, and it still didn't work.Stinkhorn
It didn't work for me. I got the old one image not loading (still background color was presented instead of an image) and it still was presented for a fraction of second before the new launch screen appeared.Cammi
E
12

Uninstall your app, restart your phone and install your app again... This actually fixed in my case.

Electronics answered 22/3, 2016 at 6:44 Comment(2)
What if this happens in Production? You can not expect every user to uninstall, restart the device.Mccaffrey
@RohitSingh that is a good question.Magazine
A
8

What worked for me:

  • Deleting the LaunchScreen's Scene and View Controller and create a new one (make sure you set it as "Initial View Controller" in the Attributes Inspector).

What did not work for me:

  • Deleting the app
  • Restarting the iPhone, Mac or Xcode
  • Deleting Derived Data
  • Deleting the device's container
  • Cleaning
  • Burning 3 Steve Jobs Voodoo dolls

Note:

Sometimes erasing (simulator) is needed too

Adversity answered 22/1, 2019 at 2:40 Comment(2)
I'm not convinced. I'm going to need source locations of the Steve Jobs voodoo dolls to confirm.Granoff
😂😂😂 "Burning 3 Steve Jobs Voodoo dolls"Magazine
D
5

I also faced the same issue. It happens because the simulator/ iOS device caches the launch image when you first launch the application. I added some modifications to Brian Trzupek's answer:

  1. Delete the image set from Xcode assets (eg. launch_image)
  2. Add a new image set and add images to it.
  3. Switch off and switch on the iOS Device. (Reset Contents and Settings for simulator).
  4. Clean the Xcode build folder (Press command + option + shift + K).
  5. Delete the app from the device/simulator (if available).
  6. Run again.
Dorsiventral answered 14/11, 2017 at 13:28 Comment(0)
T
5

Solution Work For Me

  1. Delete your app from the device
  2. Switch off device
  3. Switch on device
  4. clean Build Folder
  5. Again build and install and launch app.

    Enjoy

Trichology answered 29/5, 2020 at 5:50 Comment(0)
E
4

Honestly, I didn't take the risk to go live without being sure if this will be updated or not.

So, assuming you are using xcassets, a simple solution is:

  1. Delete the old image set
  2. Recreate one with a different name and add your splash screen images
  3. Update your storyboard to use this 'new' image set reference

It will update for sure ! (I even tested with app already installed on the device). No need to clean cache of device or so.

Extenuate answered 30/4, 2018 at 14:31 Comment(0)
J
3

Just connect your device, go to Xcode > Window > Devices > Your device, now in installed apps, select your app, right click and download container, go to the generated file, right click, Show package contents, AppData, Library, Caches, and delete files. Now go to Xcode > Window > Devices > Your device > your app and right click to replace containers.

Japha answered 18/12, 2016 at 20:3 Comment(0)
T
3
  1. Delete your app from the device
  2. Power down the device
  3. Power up device
  4. Install and launch app.
Tripterous answered 14/6, 2018 at 1:47 Comment(0)
H
2

Xcode 10/iOS 12

After trying all the things mentioned above, I had to delete the imageview from the LaunchScreen and replace it with a new one.

Hood answered 28/2, 2019 at 16:28 Comment(2)
position the image outside the asset folder and replace the imageview from the launch screen with a new one referenced to the image. This works for me !Splinter
Didn't work for me :/Hypogene
G
2

This worked for me: http://arsenkin.com/launch_screen_image_cache.html

Again, thanks to the thread I have referenced above I found a way to solve this issue - name your new image differently from the one there was before in case your new one has the same name as the old one and put it out of the *.xcassets folder to the project directory and reference it in your UIImageView. And that's it. Sound stupid easy but oh gawd how much rage I had.

I can confirm that @JERC worked and thanks to arsenkin

In my case I work on a react native project and had a .storyboard file in ios/projectname I just want to replace the old image with the same size and keep the old constraints. I didn't want the user to delete the app or restart their phone.

WHAT I DID

  1. Copy the image to the project src (in my case I put mine in src/assets).
  2. Open finder and drag the image to xcode project in to the project directory.
  3. There will be a popup make sure you create a reference to the project. here
  4. Change the image src in .storyboard to the referenced image. here
  5. Clean build folder. here
  6. Rebuild app
Greenling answered 28/5, 2021 at 4:21 Comment(0)
P
1

Ok, so I figured out the issue. In the previous version of my app, we were using a Launch Screen XIB. Somewhere in the development of this new version, the xib was deleted and replaced only with static launch images.

The solution is to use a Launch Screen XIB. I noticed that the moment I used a launch screen xib for the first time, the file stored in the snapshots directory was replaced with the snapshot of the xib.

Pantomimist answered 9/10, 2015 at 1:7 Comment(2)
Nope, I am using a Launch Screen XIB and it is not updating. I guess you workaround the problem by switching from Launch Screen > Static image > Launch Screen. Modifying the launch screen in XCode and running it still shows the old launch screen on the iPhone. The image is cached on the device. I guess if I change the name of the launch screen it will do the trickWhitelivered
Recreating a launch screen with a different name did not workaround the problem, still seeing the old one. The only "hope" is that iOS regenerates its cache at every app update, but I cannot find any documentation on thisWhitelivered
A
1

This is the fastest way I found to resolve this issue although it sounds stupid:

  1. Right click on LaunchScreen.xibor on your launchscreen file and select Remove file then select Remove to trash. This will remove all references of the file and its past updates from your project.

  2. Go into your trash and drag and drop the file back into your xCode project (within yourProjectName).

  3. Clean and rebuild.

Avoirdupois answered 15/8, 2019 at 11:48 Comment(0)
S
1

Use this piece of code to clean launch screen cache:

import UIKit

public extension UIApplication {
    func clearLaunchScreenCache() {
        #if DEBUG
        do {
            let launchScreenPath = "\(NSHomeDirectory())/Library/SplashBoard"
            try FileManager.default.removeItem(atPath: launchScreenPath)
        } catch {
            print("Failed to delete launch screen cache - \(error)")
        }
        #endif
    }
}

Usage:

UIApplication.shared.clearLaunchScreenCache()
Superman answered 10/2, 2020 at 12:23 Comment(0)
H
1

Make sure you did all these steps

  1. Search for ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME key in build setting and search its assets value in entire application then remove it.
  2. Delete ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME from Build setting.
  3. Create New Launch screen Xcode -> File -> New -> File -> Launch Screen
  4. Goto App main Target -> General -> App Icons and Launch Images -> Launch Screen File -> Choose the New Launch Screen File.
  5. If you just changing the old Launch screen, try naming the new assets with different names.
Herbst answered 9/7, 2020 at 12:33 Comment(0)
L
1

For Simulator Or For Real Device You just need to follow these steps.

  1. remove you splash from xc assets.
  2. drag and drop png or jpg file into Root.
  3. LaunchScreen.xib or storyboard. open ViewController and set ImageView ref that particular image which you dragged.

If you don't have ViewController and using old version react you will just found there named as View. so remove that and make new ViewController in case if that View doesn't show your Splash.

Lustrum answered 15/10, 2020 at 14:47 Comment(0)
L
0

Had this problem also. Being a total novice I naively changed the LaunchScreen.storyboard to LaunchScreen.xib. The run failed (duh), so I changed it back to .storyboard re-ran the app just to test I'd not screwed anything else up - and the old screen didn't appear first. So whatever I did, it must have flushed out the old cache.

Lecce answered 19/2, 2016 at 8:10 Comment(0)
E
0

Try opening the simulator, going to Hardware -> Erase All Content and Settings.

Exsect answered 18/3, 2019 at 11:30 Comment(0)
B
0

Had same problem but only with image used in launchscreen storyboard. Moving the image from the asset catalog changing its' name to the app bundle (for example, old image set in asset catalog was called launch_logo, and image in app bundle is called launchscreen_logo.png) solved the issue for us.

Busily answered 7/8, 2019 at 10:32 Comment(0)
M
0

I guess these are depended on situations. When It happens at debug or testing, works on deleting image on launch screen. Or uninstalling your apps, then restart launch.

But It goes even after archive, then It doesn't solve with reset and clean.

Moult answered 4/3, 2020 at 8:4 Comment(0)
L
0

In my case, I haven't selected App Icons Source From App Setting -> General -> App Icons and Launch Images -> App Icons Source

enter image description here

Laurin answered 30/3, 2020 at 15:16 Comment(0)
R
0

Try it in AppDelegate

    if #available(iOS 13.0, *) {
        do {
            try FileManager.default.removeItem(atPath: NSHomeDirectory()+"/Library/SplashBoard")
        } catch {
            print("Failed to delete launch screen cache: \(error)")
        }
    } else {
        print("ios is min")
    }
Rosemaria answered 9/4, 2020 at 7:22 Comment(0)
R
0

Inspired by Guilherme Rambo's blog entry, I've created a cordova-plugin to programmatically purge the launch screen cache on iOS 13+:

cordova.plugins.launchScreenCache.deleteLaunchScreenCache().finally((result) => {
    // returns true in the success case, false if iOS <13
    // rejects in an error case
});

More information can be found on the GitHub repo

Reverence answered 8/9, 2020 at 13:29 Comment(0)
D
0

First of all

Clean & Build project

Method 1:
Rename the Splash image loaded in LaunchScreen.storyboard.

For example, I loaded "splash" but changed it to "splashNew".

Method 2:

Run your app on a different device or emulator

For example, if you run app in a emulator iphone 11 run it into iphone 12

Dashtilut answered 6/4, 2022 at 12:48 Comment(0)
G
0

2024 the problem still exists, my solution is: Turn off iPhone and rebuild. Simply when the device is turned off, the caches will be deleted. But products in the store will be affected after updating to the new version. Cannot force user to restart device, someone has solution. Waiting apple update fix version !

Giovanna answered 13/3 at 3:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.