Clean iOS app splash screen cache on React Native Expo
Start your iOS app with a fresh launch screen - clean your splash screen cache with ease
When changing the splash screen in a React Native Expo app, you may notice the old launch screen persists. This happens because iOS caches splash images, and the cache is not cleared even after deleting the app.
To clear the iOS launch screen cache in an Expo app, create a custom AppDelegate subscriber that removes the cached splash images on every app start. This involves a Swift class extending ExpoAppDelegateSubscriber and registering it in the module config.
AppLifecycleDelegate.swift
import ExpoModulesCore
import UIKit
public extension UIApplication {
func clearLaunchScreenCache() {
do {
let launchScreenPath = "(NSHomeDirectory())/Library/SplashBoard"
try FileManager.default.removeItem(atPath: launchScreenPath)
} catch {
print("Failed to delete launch screen cache - (error)")
}
}
}
public class AppLifecycleDelegate: ExpoAppDelegateSubscriber {
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UIApplication.shared.clearLaunchScreenCache()
sleep(5)
return true
}
} Expo modules are configured in expo-module.config.json. This file currently is capable of configuring autolinking and module registration.
expo-module.config.json
{
"ios": {
"appDelegateSubscribers": ["AppLifecycleDelegate"]
}
} Conclusion
In custom iOS builds, launch screens can remain cached between builds, making it difficult to test new images. While Apple recommends clearing derived data before rebuilding (achievable with npx expo run:ios --no-build-cache), this does not always work. The approach above programmatically clears the launch screen cache on every app start, ensuring the latest splash image is always displayed.