Rohan
Rohan

Reputation: 2935

Relaunching the app with splash screen issue when running app from background

I have made an universal app. There are 3 views in my app.

There is a splash screen in the app.

I am suffering from 1 issue that when i go in background by pressing home button from the 1st view and come back from the background , the app relaunches with the splash screen.

But when i go in background by pressing home button from the 2nd view and come back from the background , the app launches with the same screen i left from.

Step by step produce ;

And on runnig in device, it gives crash log as ;

InstanceNotExists

Terminating app due to uncaught exception 'InstanceNotExists', reason: 'Attempted to access instance before initializaion. Please call takeOff: first.'

I want to stop the whole app relaunching from the begining , instead of from the last resume state.

How can i do it?

Thanks.

Upvotes: 0

Views: 1733

Answers (2)

Bhavin
Bhavin

Reputation: 27225

1) Have you checked Debugging on Device ?

  • It will work Perfectly on Device. Problem is related to Simulator. Try to Debug on the device itself and it will work as expected for sure.

2) Check your info.plist file. If you find any entries for "UIStatusBarHidden" and "UIStatusBarStyle", then simply remove them.

Go through : Prevent Splash Screen from showing after returning from background

Upvotes: 2

Durgaprasad
Durgaprasad

Reputation: 1951

If you have added splash screen then u set a value in user defaults. BOOL value. In first run make it yes. then check that value to decide whether to show splash or not. In appdelegate.m

 if(![[NSUserDefaults standardUserDefaults] boolForKey:@"splash"])
    {
        [[NSUserDefaults standardUserDefaults] setObject:NO forKey:@"splash"];
    }
 if(    [NSUserDefaults standardUserDefaults]boolForKey:@"splash" == NO)
{
  //launch splash screen
}

Upvotes: 0

Related Questions