0

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 ;

  • Start app , splash screen shows for approx. 3 seconds and app starts.
  • Press home button, app goes to background.
  • Bring app back from background

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.

Rohan
  • 2,939
  • 5
  • 36
  • 65
  • AFAIK this is an iOS handled behaviour, it does not relaunch the app. Check by adding debug points in the view controller lifecycle method. If it is relaunching the app it means that your app is getting killed while entering background from view1. In that case do you see any crash logs? – Amar May 27 '13 at 13:23
  • @Amar- thanks for reply. No there is no any crash logs. It just relaunches the whole app from the begining. – Rohan May 27 '13 at 13:26
  • Is this happening in device or simulator? – Amar May 27 '13 at 13:26
  • @Amar- it is in device. – Rohan May 27 '13 at 13:27
  • @Amar- no i have not set any key like that. and also tried to use that key with NO value, but no solved the issue – Rohan May 27 '13 at 13:34
  • This is strange, since whenever the app is killed by the iOS there will be a crash log generated. Are you sure there is no crash log file created on device? – Amar May 27 '13 at 13:37
  • @Amar - thanks again. Ya it gives an error of"InstanceNotExists" crash log – Rohan May 27 '13 at 13:44
  • Can you add the symbolicated crash log in the question? – Amar May 27 '13 at 13:45

2 Answers2

2

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

Community
  • 1
  • 1
Bhavin
  • 27,155
  • 11
  • 55
  • 94
0

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
}
Durgaprasad
  • 1,910
  • 2
  • 25
  • 44
  • thanks for reply. Actually it is not only the issue of splash screen. But the whole app relaunches from the begining. i.e whole app restarts instead of resumeing from the last state(screen) – Rohan May 27 '13 at 13:23