When I kill my iPhone app and relaunch it I have an image of the app's previous state instead of the launch image. How can I force iOS to always show the launch image?
-
Are you able to observe launch image anytime? – kkocabiyik Jan 04 '14 at 23:39
-
Yes. The launch image appears on the 1st run, but doesn't after the kill & relaunch. – DataZombies Jan 04 '14 at 23:40
-
Are you testing it on debug mode or deploying to device and disconnecting from computer? – kkocabiyik Jan 04 '14 at 23:47
-
I'm deploying to my iPhone and disconnected from the Mac. – DataZombies Jan 04 '14 at 23:49
-
I think that is a system level issue, after you wait sometime it will show your launch image again – kkocabiyik Jan 05 '14 at 00:00
-
your an app with Cordova/PhoneGap based – codercat Jan 05 '14 at 01:40
5 Answers
To force iOS to launch an app with its default image, call [[UIApplication sharedApplication] ignoreSnapshotOnNextApplicationLaunch];
where you implement state preservation.
From the documentation:
When your app is relaunched, the system displays this snapshot image in place of your app’s default launch image to preserve the notion that your app was still running. If you feel that the snapshot cannot correctly reflect your app’s user interface when your app is relaunched, you can call this method to prevent that snapshot image from being taken. If you do, UIKit uses your app’s default launch image instead.
Also look at this question for more details.
-
1hurmmm...I put [application ignoreSnapshotOnNextApplicationLaunch]; in my applicationWillResignActive and applicationWillTerminate. Didn't work. – DataZombies Jan 05 '14 at 02:05
ignoreSnapshotOnNextApplicationLaunch method will not be called if the app is not invoked during state restoration.
If your app is NOT supporting Multitasking feature, which the UIApplicationExitsOnSuspend key in its Info.plist is Set to YES. The suggested solution will not work.
For me, I used the code below:
applicationWillResignActive is used for the situation when the app is running, you double click the home button to call the multitasking tray. The splash screen will show on the application screen. It works perfectly.
applicationWillTerminate is not working every time because the function could be never called on some stages
- (void)applicationWillResignActive:(UIApplication *)application {
NSLog(@"Application Did Resign Active");
self.viewController.webView.hidden = YES;
NSString *splashImage;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
splashImage = @"Default-Portrait~ipad.png";
}
else {
splashImage = @"Default~iphone.png";
}
UIImageView *splash = [[UIImageView alloc]initWithFrame:[self.window frame]];
[splash setImage:[UIImage imageNamed:splashImage]];
[self.window addSubview:splash];
}
- (void)applicationWillTerminate:(UIApplication *)application {
NSLog(@"Application is Terminated");
self.viewController.webView.hidden = YES;
NSString *splashImage;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
splashImage = @"Default-Portrait~ipad.png";
}
else {
splashImage = @"Default~iphone.png";
}
UIImageView *splash = [[UIImageView alloc]initWithFrame:[self.window frame]];
[splash setImage:[UIImage imageNamed:splashImage]];
[self.window addSubview:splash];
}

- 110
- 1
- 7
-
Unless your App runs in background, the will terminate won't be called – CarmeloS Jan 14 '15 at 13:08
-
This method would get triggered even when there is a permission popup, so some additional checks required...? – Ashwin G Jan 02 '19 at 20:12
Please follow this -
-(void)applicationWillResignActive:(UIApplication *)application
{
imageView = [[UIImageView alloc]initWithFrame:[self.window frame]];
[imageView setImage:[UIImage imageNamed:@"Portrait(768x1024).png"]];
[self.window addSubview:imageView];
}
Here to remove your imageview:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
if(imageView != nil) {
[imageView removeFromSuperview];
imageView = nil;
}
}
It is working and tested many times.

- 199
- 1
- 6
-
This will work, but it also changes the snapshot when using multitask list in iOS 7, which is not suggested. – CarmeloS Jan 14 '15 at 13:09
Swift 4.2
func applicationDidEnterBackground(_ application: UIApplication) {
let imageView = UIImageView(frame: self.window!.bounds)
imageView.tag = 25
imageView.image = UIImage(named: <YOUR_SPLASH_SCREEN_IMG>)
UIApplication.shared.keyWindow?.subviews.last?.addSubview(imageView)
}
func applicationWillEnterForeground(_ application: UIApplication) {
if let imageView : UIImageView = UIApplication.shared.keyWindow?.subviews.last?.viewWithTag(25) as? UIImageView {
imageView.removeFromSuperview()
}
}

- 550
- 7
- 18
For my current project I wanted to force re-launch after the app is killed. I added this to the app's plist:
To insure the splash screen was correct, I used the suggestions above:
- (void)applicationWillResignActive:(UIApplication *)application {
[[UIApplication sharedApplication] ignoreSnapshotOnNextApplicationLaunch]; }
and
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[UIApplication sharedApplication] ignoreSnapshotOnNextApplicationLaunch]; }
It is working well.

- 652
- 1
- 7
- 15