Reputation: 3072
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?
Upvotes: 241
Views: 106913
Reputation: 21
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 !
Upvotes: 1
Reputation: 5390
I have been able to reliably get the springboard cache cleared for testing launch image changes by doing this:
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.
Upvotes: 443
Reputation: 2762
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
Upvotes: 69
Reputation: 78
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
Upvotes: 0
Reputation: 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.
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
src/assets
).Upvotes: 2
Reputation: 67
For Simulator Or For Real Device You just need to follow these steps.
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.
Upvotes: 1
Reputation: 1208
In my case, I haven't selected App Icons Source
From App Setting -> General -> App Icons and Launch Images -> App Icons Source
Upvotes: 0
Reputation: 365
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
Upvotes: 0
Reputation: 849
Make sure you did all these steps
Upvotes: 1
Reputation:
Sometimes erasing (simulator) is needed too
Upvotes: 8
Reputation: 1744
Solution Work For Me
Again build and install and launch app.
Enjoy
Upvotes: 6
Reputation: 1
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")
}
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 305
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()
Upvotes: 0
Reputation: 2558
This is the fastest way I found to resolve this issue although it sounds stupid:
Right click on LaunchScreen.xib
or 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.
Go into your trash and drag and drop the file back into your xCode project (within yourProjectName
).
Clean and rebuild.
Upvotes: 1
Reputation: 1675
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.
Upvotes: 0
Reputation: 14296
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:
Upvotes: 5
Reputation: 1451
Try opening the simulator, going to Hardware -> Erase All Content and Settings.
Upvotes: 0
Reputation: 4918
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.
Upvotes: 2
Reputation: 1624
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.
Upvotes: 22
Reputation: 31
Upvotes: 3
Reputation: 1880
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:
- Delete the old image set
- Recreate one with a different name and add your splash screen images
- 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.
Upvotes: 4
Reputation:
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.
Upvotes: 3
Reputation: 540
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.
Upvotes: 15
Reputation: 1095
Uninstall your app, restart your phone and install your app again... This actually fixed in my case.
Upvotes: 12
Reputation: 9
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.
Upvotes: 0
Reputation: 3072
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.
Upvotes: 1